开发者

import MySQLdb error

Hi I have the following error when trying to import MySQLdb. Does anyone know what the issue could be?(I'm on a mac)

>>> 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/christopherfarm/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): no suitable image found.  Did find:
    /Users/christopherfarm/.python-eg开发者_StackOverflow中文版gs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so: mach-o, but wrong architecture


You havbe to either install an egg built for your architecture, or install from source (i.e. .zip or .tar.gz).


Me too I had a lot of headache with MySQLdb.

If you are starting new development I would suggest to switch to the official MysQL Python Connector: (available on PyPI):

sudo pip install mysql-connector-python

or by download from: http://dev.mysql.com/downloads/connector/python/

Documentation: http://dev.mysql.com/doc/refman/5.5/en/connector-python.html

It's easy to use and also compatible with PEP 249 (Python DB API version 2.0).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜