我和许多人一样,正在尝试在Mac Snow Leopard(10.6.x)上运行Python的MySQLdb。我已经按照各种博客/论坛帖子的建议安装了64位的MySQL DMG,并且使用setuptools和MySQLDB本身进行了安装。
ARCHFLAGS='-arch 86_64' python2.7 setup.py clean
ARCHFLAGS='-arch 86_64' python2.7 setup.py build
sudo ARCHFLAGS='-arch 86_64' python2.7 setup.py install
从上面可以看出我已经升级到了Python 2.7,一切似乎都很好,但是当我尝试把MySQLdb导入Python shell时出现了问题。
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/ad/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib
Referenced from: /Users/ad/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
Reason: Incompatible library version: _mysql.so requires version 17.0.0 or later, but libmysqlclient.16.dylib provides version 16.0.0
我进行了搜索,找到了libmysqlclient.16.dylib,但没有找到libmysqlclient.17.dylib。
是什么原因导致了这个问题,如何解决?虽然我搜索了libmysqlclient.17.dylib,但似乎没有关于它的任何信息。它是否存在?
谢谢。