简体   繁体   English

Python MySQL在Mac OS X 10.6 i386上安装错误

[英]Python MySQL installing wrongly on Mac OS X 10.6 i386

When trying to install MySQL's python bindings, MySQLdb, I followed the instructions to build and install on my MacBook running Mac OS X 10.6 i386, and after entering the following line into the terminal: 在尝试安装MySQL的python绑定MySQLdb时,我按照说明在运行Mac OS X 10.6 i386的MacBook上构建和安装,并在进入终端后输入以下行:

user-152-3-158-79:MySQL-python-1.2.3c1 jianweigan$ sudo python setup.py build

I get the following errors: 我收到以下错误:

running build
running build_py
creating build/lib.macosx-10.3-i386-2.6
copying _mysql_exceptions.py -> build/lib.macosx-10.3-i386-2.6
creating build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
creating build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.3-i386-2.6
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation

It looks like the setup.py build script is recognizing my OS as Mac OS X 10.3 instead of 10.6 so it tries to locate an older version of XCode which I don't have. 看起来setup.py构建脚本将我的操作系统识别为Mac OS X 10.3而不是10.6,所以它试图找到我没有的旧版XCode。

Does anyone know how to get around this problem? 有谁知道如何解决这个问题? Perhaps manually configuring the script to recognize my os as 10.6? 也许手动配置脚本以将我的操作系统识别为10.6?

It appears you have installed and are using a python.org python2.6. 看来你已经安装并正在使用python.org python2.6。 Because that installer is designed to work for a range of systems, to build extensions with that python on 10.6, you need to install the optional 10.4 SDK which is part of the Xcode package on the Snow Leopard installation DVD or machine restore DVD; 因为该安装程序适用于一系列系统,要在10.6上使用该python构建扩展,您需要安装可选的10.4 SDK,它是Snow Leopard安装DVD或机器还原DVD上的Xcode包的一部分; the 10.4 SDK is not installed by default. 默认情况下不安装10.4 SDK。 That's what the message is trying to tell you. 这就是消息试图告诉你的。

从python.org安装最新版本的Python,为我解决了这个问题。

Well the error is pretty clear, do you have xcode installed? 那么错误很清楚,你有安装xcode吗? http://developer.apple.com/tools/Xcode/ http://developer.apple.com/tools/Xcode/

You can look at a more detailed solution to this in http://blog.some-abstract-type.com/2009/09/mysql-python-and-mac-os-x-106-snow.html which includes downloading the latest xcode. 您可以在http://blog.some-abstract-type.com/2009/09/mysql-python-and-mac-os-x-106-snow.html中查看更详细的解决方案,其中包括下载最新的xcode。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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