【发布时间】:2015-12-27 02:25:18
【问题描述】:
我正在尝试使用 python setup.py install 安装 python 包,但在安装过程的某些时候出现错误:
gcc: error: x86_64: No such file or directory
gcc: error: unrecognized option ‘-arch’
error: command 'gcc' failed with exit status 1
以前,我为 Xcode 7 安装了 Xcode 7.0 和它们各自的命令行工具。编译器似乎在 which gcc 本地 /usr/local/bin/gcc。但是,当我尝试gcc -v 时,我得到了Segmentation fault: 11。此外,当我尝试/usr/bin/gcc -v 时,我得到了
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
然后,安装的编译器似乎位于不同的位置。 Command line tool installed, but gcc/g++ compiler not working 中提出了类似的问题,但没有明确的解决方案。您知道如何修复它(链接到实际安装的编译器以继续安装 Python 包)?提前致谢。
【问题讨论】:
-
您可能想看看设置了哪些环境变量会影响路径或编译器操作。
-
如果安装了 Xcode 命令行工具(它们安装在
/usr/bin中),则不需要--prefix。使用xcode-select --install。 -
当我输入
xcode-select --install这就是我得到的xcode-select: error: command line tools are already installed, use "Software Update" to install updates@Droppy -
OK 删除
--prefix并使用CC=clang ./configure <other-options>。 -
@Droppy 我需要修改哪个文件?
标签: python macos gcc osx-yosemite