![](/img/trans.png)
[英]I suspect I have multiple version of Python 2.6 installed on Mac OS X 10.6.3; how do I set which one Terminal should launch?
[英]Which GCC version do I have on my OS X Sierra
当我输入gcc -v
,我得到:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
所以我的gcc版本是4.9.2但是,当我尝试通过键入以下命令再次安装gcc时: brew tap homebrew/versions; brew install gcc --without-multilib
brew tap homebrew/versions; brew install gcc --without-multilib
我得到:
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/science, homebrew/versions).
==> New Formulae
git-quick-stats homebrew/science/med-file ktmpl
==> Updated Formulae
aha homebrew/science/bowtie mpd
akka homebrew/science/cdo mysql-cluster
arangodb homebrew/science/matplotlib no-more-secrets
buku homebrew/science/packmol nvm
bullet homebrew/science/paraview protobuf-swift
casperjs homebrew/science/pymol qca
certigo imagemagick ✔ ringojs
chicken imagemagick@6 rust
cjdns jenkins skinny
coffeescript jigdo sqldiff
compcert jump sqlite-analyzer
crystal-lang kobalt svtplay-dl
dbhash libhdhomerun swiftgen
digdag libphonenumber vim
direnv libsigsegv wakatime-cli
elixirscript mapserver wolfssl
embulk mecab-jumandic yank
geoserver mkvtoolnix yaz
gitlab-ci-multi-runner mosquitto
==> Deleted Formulae
bip homebrew/versions/openssl101 probatron4j
edelta lcab rtpbreak
esound malaga
Updating Homebrew...
Warning: gcc-6.3.0_1 already installed
此输出最后显示我有gcc 6.3。 我正在使用gcc 4.9.2或gcc 6.3吗?
PS:如果您对我为什么执行brew tap&brew install命令感兴趣,那是因为我正在尝试在python中安装xgboost。 在xgboost的github存储库中 ,他们建议在安装之前运行上述命令,以获取最新的g ++编译器。
要解决您的问题“我正在使用gcc 4.9.2还是gcc 6.3”
您仍在使用gcc 4.9.2。
如何使gcc-6成为默认编译器? 见下文:
sudo ln -s <path-to>/gcc-6 <path-to>/gcc
现在退出终端会话,并打开一个新终端(链接会更新),然后键入gcc -v
,查看该版本是否为最新版本。
注意:您可能还希望以类似的方式更新c++ -> c++-6
, g++ -> g++-6
和cpp -> cpp-6
,只需依次重复上述步骤,请始终备份,以防万一错误,因此您可以在必要时撤消所有操作。
如果收到“不允许操作”警告,并且您正在使用El Capitan或更高版本的Mac OS X,请参阅此问题/解答,以了解如何禁用阻止您对/ usr / bin目录进行更改的安全功能:
https://superuser.com/questions/933019/sudo-cant-create-file-in-usr-bin-in-el-capitan
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.