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/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/narf/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.6-i386.egg-tmp/_mysql.so, 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/_mysql.so 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
(I use Homebrew):
pip uninstall MySQL-python brew uninstall mysql brew install mysql --universal pip install MySQL-python
Happy djangoing! -_-'