以下都是Mac环境的
安装报错unable to execute llvm-gcc-4.2:
No such file or directory error: command 'llvm-gcc-4.2' failed with exit status 1
解决方法:
打开Xcode,在Xcode-Preferences-Downloads-Components 下载Command line tools
然后可以测试下 which gcc 输出 /usr/bin/gcc
然后执行 python setup.py clean
python setup.py install 应该就可以正确安装了
后面可能还会遇到问题:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg
/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg/_mysql.so
Reason: image not found
Reason: image not found
这个可以执行: sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/
可以在交互模式测试导入MySQLdb试试 >>>import MySQLdb
这个时候没有报错就说明MySQLdb没问题了
暂时先这样了