eclipse pydev error – not finding

I just compiled and installed mysqldb for python 2.7 on my mac os 10.7.

import MySQLdb as mysql
def main():
conn = mysql.connect( charset="utf8", use_unicode=True, host="localhost",user="root", passwd="",db="" )
if __name__ == '__main__'():
main()

When executing it I get the following error message

Traceback (most recent call last):
File "/path/to/project/Python/src/cvdv/TestMySQLdb.py", line 4, in
import MySQLdb as mysql
File "build/bdist.macosx-10.6-intel/egg/MySQLdb/__init__.py", line 19, in
namespace cvdv
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in
File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/toom/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/toom/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
Reason: image not found

I need to tell my pydev eclipse version where to find it.
I added a symbolic link as follows, goto /usr/lib and then do the following:

sh-3.2# ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib libmysqlclient.18.dylib
sh-3.2# ls libmysqlclient.18.dylib
libmysqlclient.18.dylib
sh-3.2# ls -l libmysqlclient.18.dylib
lrwxr-xr-x 1 root wheel 44 Dec 13 21:08 libmysqlclient.18.dylib -> /usr/local/mysql/lib/libmysqlclient.18.dylib

re run eclipse it should start working.

Leave a Reply

Your email address will not be published. Required fields are marked *