在OSX 10.6上使用python设置MySQL的问题

时间:2011-07-05 16:36:37

标签: python mysql django

我正在尝试在OSX 10.6上安装MySQL以使用Django。

MySQL似乎已正确安装。

我正在尝试为Python安装MySQLdb 我尝试过使用easy_install

$ python setup.py install

完成

但是我收到了以下错误:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MySQLdb/__init__.py", line 19, in <module>
    import _mysql
  File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in <module>
  File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/alanquigley/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/alanquigley/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
  Reason: image not found
>>> 

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

检查以确保正确安装了mysql客户端库(C客户端库)。在/ usr / include或/ usr / local / include中查找名为“mysql”的文件夹。对/ usr / lib或/ usr / local / lib执行相同的操作。