Friday, February 4, 2011

python, Mac, MySQLdb "wrong architecture"

I thought I'd post this tip since I had a few false starts following other pointers I found on the web -- I'd like to save others the wasted effort.

The error (MySQLdb "wrong architecture") IS because of a mismatch between the version of python and the version of the OS that you're running.



If you are trying to import MySQLdb into Python and getting a "wrong architecture" error message, try the following:

First, determine the version of your OS by typing

uname -a

into a shell (Thanks OSXDaily)



Then install a current version of Python that matches this architecture from python.org, reinstall MySQLdb and see if it works.

This is all that it took for me to be up and running, and is (relatively) painless.

Note: be sure that your scripts point to the newly installed version at /usr/local/bin/python, rather than the system version at /usr/bin/python

No comments: