python - import MySQLdb ImportError -


i think installed mysql correctly. positive, except fact isn't working

$ python >>> import mysqldb 

returns

traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "mysqldb/__init__.py", line 19, in <module>     import _mysql importerror: dlopen(/users/msmith/documents/dj/mysite/venv/lib/python2.7/site-packages/mysql_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so, 2): library not loaded: libmysqlclient.18.dylib   referenced from: /users/msmith/documents/dj/mysite/venv/lib/python2.7/site-packages/mysql_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so   reason: image not found 

does have ideas on how fix this? thanks

create symbolic link library

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib 

or add path profile

export dyld_library_path=/usr/local/mysql-5.5.15-osx10.6-x86/lib/:$dyld_library_path 

Comments