简体   繁体   中英

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

I am setting up os X 10.7.

I am using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

I use a Python based package manager called easy_install. Easy_install seems to not be able to find the compiler.

EDIT: When I tried to install MySQL-python I got this error:

$ 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

Xcode 4.1 used GCC, but with Xcode 4.2 that seems to have changed.

What compiler does Apple want us to use? How do I setup the configuration so I can compile OSS?

I had the exact same problem when I upgraded from OSX 10.6 to 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.

Here's what worked for me:

  1. Install the latest version of XCode from the App Store
  2. Inside XCode, go to Preferences -> Downloads -> Components
  3. download the Command Line Tools

That's all you need to do. Try to install again in a new shell. The command line tool installation will put llvm-gcc-4.2 into /usr/bin which should be in your default path. 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

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:

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:

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

Using OS X 10.7.5 (Lion)

I tried the XCode solution, but my gevent pip installation still wasn't successful. Then, I tried building libevent from source but still no success with gevent installation. However, after I did

    brew install libevent

I was able to successfully install gevent with

    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.)

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).

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').

See this post: cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5

Sounds to me you ran into this issue . The thread shows a variety of solutions.

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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