我正在尝试安装 MySQLdb python,但由于出现体系结构错误而无法使其正常工作。
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/jkeesh/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/jkeesh/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg-tmp/_mysql.so: mach-o, but wrong architecture
这是一个常见的问题,我已经阅读了很多很多资料,包括:
http://www.mechanicalgirl.com/view/installing-django-with-mysql-on-mac-os-x/
Mac OS 10.6.2 Snow Leopard 上的 Django + MySQL
和许多其他链接。
看来问题是 32 位 64 位不匹配,但我不确定正确的组合是什么,或者不匹配到底是什么。
我已经从 pip、Mac 端口安装,并从源代码构建。我尝试将 和 设置ARCHFLAGS
为i386
和x86_64
。
我试过设置VERSIONER_PYTHON_PREFER_32_BIT
和VERSIONER_PYTHON_PREFER_64_BIT
偏好。
我正在运行 Mac OS X 10.6.6
我已经安装了mysql/usr/local/mysql
$ file $(which ./mysql)
./mysql: Mach-O executable i386
我有mysql版本5.5.12
我有64 bit Python 2.6.6.
我的系统架构是:
>>> platform.platform()
'Darwin-10.6.0-i386-64bit'
$ file $(which python)
/opt/local/bin/python: Mach-O 64-bit executable x86_64
如果有任何链接,您可以指出我或尝试的建议,我将不胜感激。无论我尝试什么,我都陷入了死胡同并且得到了同样的“错误的架构”错误。