如何在 Mountain Lion 上安装 MySQLdb

2023-11-23

我是 Python 新手,在构建 MySQLdb 时遇到问题,试图让 Google AppEngine SDK 运行。我刚刚从 Snow Leopard 升级到 Mountain Lion,并安装了最新的 XCode (4.4)

我已经下载了http://sourceforge.net/projects/mysql-python/

python setup.py build 

我在终端中得到以下输出

running build
running build_py
creating build
creating build/lib.macosx-10.8-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.8-intel-2.7
creating build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb
creating build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.8-intel-    2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.8-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.8-intel-2.7
clang -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 -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.8-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
unable to execute clang: No such file or directory
error: command 'clang' failed with exit status 1

以下两个目录都存在,我不知道如何解决 clang 无法执行的问题...

/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
/usr/local/mysql/include

似乎系统正在抱怨找不到clang,它包含在Command Line Tools of Xcode。你也安装了这个工具吗?

可以通过安装

  • Open Xcode
  • 偏爱 (Command + ,)
  • Components在下面Download tab
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Mountain Lion 上安装 MySQLdb 的相关文章

随机推荐