今天試着安裝mysql-python包,剛開始是報“clang”failed with exit status 1,我執行以下命令:
export CC=llvm-gcc-4.2
結果報unable to execute llvm-gcc-4.2: No such file or directory error: command 'llvm-gcc-4.2' failed with exit status 1錯誤,憤怒,執行which gcc,無反應,結果找到,是gcc未安裝的原因,兩個解決方法:
1、直接下載gcc安裝上
2、從http://stackoverflow.com/questions/8473066/gcc-4-2-failed-with-exit-status-1找到解決方法,xcode屬性-下載-components-command line tools,完成后重試which gcc,輸出/usr/bin/gcc,
執行:
python setup.py clean
python setup.py build
python setup.py install,安裝成功,測試:import MySQLdb,成功。