Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MySQLdb, Python 2.5 and OS X 10.6

MySQLdb, Python 2.5 and OS X 10.6

I wasted too much time trying to make MySQLdb work with Python 2.5 (mysteriously it worked fine with 2.7). I thought I'll share my experience.

I installed MySQLdb normally with pip install MySQL-python (yeah, ingenious name) and there were no problems. But every time I imported it, I got following error:

File "build/bdist.macosx-10.6-i386/egg/", line 6, in __bootstrap__
ImportError: dlopen(/Users/narf/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.6-i386.egg-tmp/, 2): Symbol not found: _mysql_affected_rows
Referenced from: /Users/narf/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.6-i386.egg-tmp/
Expected in: flat namespace

Many people have similar problems. Some solutions require downgrading MySQLdb and patching source by hand. None of this worked for me. What helped was reinstalling MySQL with --universal flag (I use Homebrew):

pip uninstall MySQL-python
brew uninstall mysql
brew install mysql --universal
pip install MySQL-python

Happy djangoing! -_-'

Copy link

loganlinn commented Jan 26, 2011

Thanks for saving me the headache :)

Copy link

look commented Apr 1, 2011

Thanks! This worked like a charm. I didn't want to re-install MySQL but it turned out to be pretty easy, thanks to homebrew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment