2012-05-03 84 views
4

我最近從10.6升級到Mac OS X 10.7。在Mac OS X上缺少llvm-gcc Lion:無法安裝mysql-python

我決定使用Python 2.7。

但是,當我試圖安裝MySQLdb的模塊運行Django的,它失敗:

$ sudo pip install MySQL-python 
Downloading/unpacking MySQL-python 
    […] 
    Running setup.py install for MySQL-python 
    building '_mysql' extension 
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64 
    unable to execute llvm-gcc-4.2: No such file or directory 
    error: command 'llvm-gcc-4.2' failed with exit status 1 
    Complete output from command /usr/bin/python -c "import setuptools;__file__='~/Sites/gugsm/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-AwMuqj-record/install-record.txt: 
    running install 

running build 

[…] 

building '_mysql' extension 

creating build/temp.macosx-10.7-intel-2.7 

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64 

unable to execute llvm-gcc-4.2: No such file or directory 

error: command 'llvm-gcc-4.2' failed with exit status 1 

---------------------------------------- 

的原因是,我不再有llvm-gcc也不gcc二進制文件。

我試着從3.something升級XCode到4.3.2,但它沒有幫助。它來作爲一個簡單的應用程序,它不會填充/usr/binllvm-gcc

我在做什麼錯?

回答

14

在Xcode 4.3的Preferences菜單中,選擇Downloads,然後安裝Command Line Tools

+0

謝謝你的提示。只要下載並安裝,我會告訴你是否解決了我的問題。 – alexpirine

+0

再次,謝謝。它只是解決了問題:) – alexpirine

+0

@Ned:謝謝!我在這個蘋果廢話上拉我的頭髮,你解決了我的問題:-) –

4

做一個符號鏈接爲我工作:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2