简体   繁体   English

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

[英]gcc-4.2 failed with exit status 1

I've been looking for an answer to this issue but I couldn't find it, so here it is. 我一直在寻找这个问题的答案,但我找不到它,所以在这里。

I'm trying to install Uniconvertor with a setup.py file into a MacOS X Lion (Python 2.7.2) using: 我正在尝试使用以下命令将带有setup.py文件的Uniconvertor安装到MacOS X Lion(Python 2.7.2)中:

python setup.py install

Then I get the following error code: 然后我得到以下错误代码:

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

I looked for the 'gcc-4.2' file in the Developer/usr/bin folder and it wasn't there, but there's a 'llvm-gcc.4.2' file that makes me think I should change the compiler from 'gcc-4.2' to the 'llvm-gcc.4.2' one. 我在Developer / usr / bin文件夹中查找了'gcc-4.2'文件并且它不存在,但是有一个'llvm-gcc.4.2'文件让我觉得我应该从'gcc-4.2更改编译器'到'llvm-gcc.4.2'一个。

I'm kind of new to Mac and I don't know how else to fix it. 我是Mac的新手,我不知道如何修复它。

Thanks. 谢谢。

Edit: 编辑:

I tried using: 我试过用:

cd /Developer/usr/bin
ln -s llvm-gcc-4.2 gcc-4.2

And I get a little more progress, but then a new error: 我得到了更多进步,但随后出现了一个新错误:

running install_lib
creating /Library/Python/2.7/site-packages/uniconvertor
error: could not create '/Library/Python/2.7/site-packages/uniconvertor': Permission denied

What could be the cause of this 'Permission denied'? 这个“权限被拒绝”的原因是什么?

I'm running it into an Admin account and it doesn't ask for a password or anything. 我正在运行它进入管理员帐户,它不会要求输入密码或任何东西。

Thank you again. 再次感谢你。

Try the following: 请尝试以下方法:

  1. Install the latest Xcode. 安装最新的Xcode。
  2. From Xcode's Preferences menu, install the Command Line Tools (Downloads/Components tab). 从Xcode的“首选项”菜单中,安装命令行工具(“下载/组件”选项卡)。

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

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

xcode-select --install

Try sudo python setup.py install . 尝试sudo python setup.py install

Command line utilities will not ask you to escalate privileges and so must be run in sudo mode when the situation requires it (eg, library installation into a global location). 命令行实用程序不会要求您升级权限,因此必须在情况需要时以sudo模式运行(例如,将库安装到全局位置)。

I tried @plusjeff answer, but Xcode 4.6 does not create a /Developer folder in the main directory anymore. 我尝试了@plusjeff的答案,但Xcode 4.6不再在主目录中创建/ Developer文件夹了。

Therefore I sorted it out with a symlink: 因此我用符号链接对它进行了整理:

sudo ln -s /Applications/Xcode.app/Contents/Developer /Developer

and it worked! 它工作了!

I have OSX 10.7.5 installed 我安装了OSX 10.7.5

Hope this helps! 希望这可以帮助!

I ran across this issue when installing a python library with pip. 我在使用pip安装python库时遇到了这个问题。

After running xcode-select --install , I was still getting the issue. 运行xcode-select --install ,我仍然遇到了问题。

So I created a symlink from "gcc" to "gcc-4.2" and that worked for me. 所以我创建了一个从“gcc”到“gcc-4.2”的符号链接,这对我有用。

ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/gcc /usr/local/bin/gcc-4.2

pip install --upgrade pip did not help fix the issue for me. pip install --upgrade pip对我没有帮助解决问题。

The answer by DanFreak didn't help me either, but it did give me the idea for what actually did work for me. DanFreak回答也没有帮助我,但它确实让我知道实际上对我有用的东西。

I got this error due to running an outdated version of pip. 由于运行了过时版本的pip,我收到了这个错误。 I ran pip install --upgrade pip and the error went away. 我运行pip install --upgrade pip ,错误就消失了。 Something to consider if you already have xcode command line tools installed and are still getting the error. 如果您已经安装了xcode命令行工具并且仍然出现错误,则需要考虑一些事项。

You will need the Xcode installed. 您需要安装Xcode。

Go to Xcode -> Preferences -> Locations and choose the Command Line Tools. 转到Xcode - >首选项 - >位置,然后选择命令行工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM