gcc-4.2因退出状态1而失败

val*_*ox3 21 python python-2.7 osx-lion gcc-4.2

我一直在寻找这个问题的答案,但我找不到它,所以在这里.

我正在尝试使用以下命令将带有setup.py文件的Uniconvertor安装到MacOS X Lion(Python 2.7.2)中:

python setup.py install
Run Code Online (Sandbox Code Playgroud)

然后我得到以下错误代码:

running install
running build
running build_py
running build_ext
building 'uniconvertor.app.modules.streamfilter' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DMAJOR_VERSION=1 -DMINOR_VERSION=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/modules/filter/streamfilter.c -o build/temp.macosx-10.6-intel-2.7/src/modules/filter/streamfilter.o
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

我在Developer/usr/bin文件夹中查找了'gcc-4.2'文件但它不存在,但是有一个'llvm-gcc.4.2'文件让我觉得我应该从'gcc-4.2更改编译器'到'llvm-gcc.4.2'一个.

我是Mac的新手,我不知道如何修复它.

谢谢.

编辑:

我试过用:

cd /Developer/usr/bin
ln -s llvm-gcc-4.2 gcc-4.2
Run Code Online (Sandbox Code Playgroud)

我得到了更多进步,但随后出现了一个新错误:

running install_lib
creating /Library/Python/2.7/site-packages/uniconvertor
error: could not create '/Library/Python/2.7/site-packages/uniconvertor': Permission denied
Run Code Online (Sandbox Code Playgroud)

这个"权限被拒绝"的原因是什么?

我正在运行它进入管理员帐户,它不会要求输入密码或任何东西.

再次感谢你.

jef*_*her 27

请尝试以下方法:

  1. 安装最新的Xcode.
  2. 从Xcode的"首选项"菜单中,安装命令行工具("下载/组件"选项卡).

  • `xcode-select --install`也是如此,如上所述[在Brideau的回答中](http://stackoverflow.com/a/41751022/884640) (4认同)

Ric*_*cky 8

我可以通过下载其中一个来解决这个问题:https://github.com/kennethreitz/osx-gcc-installer/releases


Bri*_*eau 5

对于较新版本的OS X(包括macOS),您只需打开一个终端并输入:

xcode-select --install
Run Code Online (Sandbox Code Playgroud)


Ray*_*Ray 3

尝试sudo python setup.py install

命令行实用程序不会要求您升级权限,因此必须在sudo情况需要时以模式运行(例如,将库安装到全局位置)。