I am trying to install MySQLdb python and am having trouble getting it to work because I get an architecture error.
>>> 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
This has been a common question, and I have read many, many sources including:
Python MySQL wrong architecture error
http://www.mechanicalgirl.com/view/installing-django-with-mysql-on-mac-os-x/
Django + MySQL on Mac OS 10.6.2 Snow Leopard
Installing MySQLdb on Mac OS X
and many other links.
It appears that the problem is a 32-bit 64-bit mismatch, but I'm not sure what the right combination is, or what exactly the mismatch is.
I have installed from pip, from Mac ports, and built from the source. I have tried setting the ARCHFLAGS
to both i386
and and x86_64
.
I have tried setting VERSIONER_PYTHON_PREFER_32_BIT
and VERSIONER_PYTHON_PREFER_64_BIT
preferences.
I am running Mac OS X 10.6.6
I have mysql installed in /usr/local/mysql
$ file $(which ./mysql)
./mysql: Mach-O executable i386
I have mysql version 5.5.12
I have 64 bit Python 2.6.6.
My system architecture is:
>>> platform.platform()
'Darwin-10.6.0-i386-64bit'
$ file $(which python)
/opt/local/bin/python: Mach-O 64-bit executable x86_64
If there are any links you can point me to or suggestions to try I would really appreciate it. I'm kind of at a dead end and getting the same "wrong architecture" error no matter what I try.