简体   繁体   English

为什么我收到错误:命令'llvm-gcc-4.2'因退出状态1而失败

[英]Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1

I am setting up os X 10.7. 我正在设置os X 10.7。

I am using the default install of Python: 我正在使用Python的默认安装:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

I use a Python based package manager called easy_install. 我使用一个名为easy_install的基于Python的包管理器。 Easy_install seems to not be able to find the compiler. Easy_install似乎无法找到编译器。

EDIT: When I tried to install MySQL-python I got this error: 编辑:当我尝试安装MySQL-python时出现此错误:

$ sudo easy_install MySQL-python 
Password:
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1

error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1 错误:安装脚本退出并显示错误:命令'llvm-gcc-4.2'失败,退出状态为1

Xcode 4.1 used GCC, but with Xcode 4.2 that seems to have changed. Xcode 4.1使用了GCC,但Xcode 4.2似乎已经改变了。

What compiler does Apple want us to use? Apple希望我们使用什么编译器? How do I setup the configuration so I can compile OSS? 如何设置配置以便编译OSS?

I had the exact same problem when I upgraded from OSX 10.6 to 10.7. 当我从OSX 10.6升级到10.7时,我遇到了完全相同的问题。 If you upgrade to 10.7 from 10.6, your version of Python may go from 2.6 to 2.7 and a result you may need to re-install most of your python packages. 如果从10.6升级到10.7,您的Python版本可能会从2.6升到2.7,结果您可能需要重新安装大多数python包。

Here's what worked for me: 这对我有用:

  1. Install the latest version of XCode from the App Store 从App Store安装最新版本的XCode
  2. Inside XCode, go to Preferences -> Downloads -> Components 在XCode内部,转到首选项 - >下载 - >组件
  3. download the Command Line Tools 下载命令行工具

That's all you need to do. 这就是你需要做的。 Try to install again in a new shell. 尝试再次在新shell中安装。 The command line tool installation will put llvm-gcc-4.2 into /usr/bin which should be in your default path. 命令行工具安装将llvm-gcc-4.2放入/ usr / bin,它应该在您的默认路径中。 The installation also takes care of library paths and stuff that you don't really want to know about unless something breaks. 除非出现问题,否则安装还会处理您不想了解的库路径和内容。

10.9 edit 10.9编辑

If you're running 10.9 or higher, I think you might be able to run this from the command line instead to install the command line tools: 如果您运行的是10.9或更高版本,我认为您可以从命令行运行此命令,而不是安装命令行工具:

xcode-select --install

I haven't verified that this is an actual fix to the problem. 我还没有确认这是解决问题的实际方法。

Alternative to installing Xcode, install GCC and related tools via: 替代安装Xcode,通过以下方式安装GCC和相关工具:

https://github.com/kennethreitz/osx-gcc-installer https://github.com/kennethreitz/osx-gcc-installer

Using OS X 10.7.5 (Lion) 使用OS X 10.7.5(Lion)

I tried the XCode solution, but my gevent pip installation still wasn't successful. 我尝试了XCode解决方案,但我的gevent pip安装仍然没有成功。 Then, I tried building libevent from source but still no success with gevent installation. 然后,我尝试从源代码构建libevent,但仍然没有成功安装gevent。 However, after I did 但是,在我做完之后

    brew install libevent

I was able to successfully install gevent with 我能够成功安装gevent

    sudo pip install gevent

(Note: greenlet is also a dependency for gevent, so you may try installing it with pip as well. It was already installed on my machine.) (注意:greenlet也是gevent的依赖项,所以你也可以尝试用pip安装它。它已经安装在我的机器上了。)

All of the suggestions here (Xcode command line options, and Kenneth Reitz' stuff) didn't work for me (I am on Mac OS X 10.7.5, Xcode 4.6.3). 这里的所有建议(Xcode命令行选项和Kenneth Reitz的东西)都不适合我(我在Mac OS X 10.7.5,Xcode 4.6.3上)。

What helped in the end was altering the cflags options in the mysql_config file (There were errors about 'unreconized command line options' while trying to 'sudo pip install MySQL-python'). 最终帮助改变了mysql_config文件中的cflags选项(在尝试'sudo pip install MySQL-python'时,有关'未配置的命令行选项'的错误)。

See this post: cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5 看到这篇文章: cc1:错误:无法识别的命令行选项“-Wno-null-conversion”在mac 10.7.5上安装python-mysql

Sounds to me you ran into this issue . 对你来说,你遇到了这个问题 The thread shows a variety of solutions. 该主题展示了各种解决方案。

Hope that helps. 希望有所帮助。

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

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