问题
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-intel/egg/MySQLdb/__init__.py", line 19, in <module>
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/samwu/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/samwu/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so: mach-o, but wrong architecture
I think the problem must be the 64bit version of python and mysql and the img _mysql.so must be 32bit
can anybd give me some suggestions
thx advc!
---------append1------
I install MySQLdb just by modify the mysql_config.path = options['mysql_config'] in setup_posix.py and then rebuild like this python setup.py build
and install,the mysql_config is point to your mysql
---------append2------
I can import MySQLdb,but it doesn't work in pydev
I checked the location of MySQLdb module in python shell like this :
import MySQLdb
print MySQLdb.__file__
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/MySQLdb/_init_.pyc
then I add the egg to my pydev lib.it works
[CLOSED]
回答1:
Do you have multiple versions of python installed? It may have installed to your non-default version and therefore won't work with it.
来源:https://stackoverflow.com/questions/11060996/why-isnt-mysqldb-installation-working-on-my-64bit-mac