Attempting to get Python communicating with MySQL via MySQLdb on OS X resulted in the following error when I tried to import MySQLdb:
Traceback (most recent call last): File "./dbtest.py", line 3, in
import MySQLdb File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/fitzsimj/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib Referenced from: /Users/fitzsimj/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so Reason: image not found
I eventually found a solution mentioned here. I added the following line to /etc/bashrc:
There is another solution suggested, using install_name_tool. That approach involves Ruby, which I’m not using.