Search

python-mysql under Snow Leopard

Getting python-mysql to work under OS X has always required a bit of prodding. Here’s what worked for me after upgrading to Snow Leopard:

  1. Make sure you are running the 32-bit (x86) version of MySQL. The python bindings compile against the 64-bit version, but don’t seem to work. Get it here.
  2. Check out the python-mysql 1.2.3c1 tag from SVN.
  3. In the directory where you checked out python-mysql, run sudo easy_install .
  4. Verify that it works with python -c "import MySQLdb".

Comments

Comment from Seth Gottlieb
Time: September 10, 2009, 1:44 am

I followed these directions and got the same errors that I got using the 64 bit version of MySQL (ImportError: dynamic module does not define init function (init_mysql)).

However, everything worked when I downgraded Python 2.6 to work in 32 bit mode and then repeated the easy_install instructions.

Comment from Jake
Time: October 5, 2009, 7:40 pm

You’re running Mac OS X, and I switched to Windows. Isn’t that like the sixth sign of the apocalypse?

Write a comment