In article <4efb9d6d.3080...@gmail.com>, Dilara Ally <dilara.a...@gmail.com> wrote: > I'm trying to import the MySQLdb for python. I downloaded the proper > setuptools egg (ver2.7) for a Mac with OSX10.6 > > I then downloaded the MySQL-python-1.2.3 and ran the following commands > > python setup.py build > sudo python setup.py install > > Then to test that the module was properly loaded I used the interactive > python prompt ad ran the following command: > > import MySQLdb > > The error message read: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "MySQLdb/__init__.py", line 19, in <module> > import _mysql > File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 7, in <module> > File "build/bdist.macosx-10.6-intel/egg/_mysql.py", line 6, in > __bootstrap__ > ImportError: > dlopen(/Users/dally/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.eg > g-tmp/_mysql.so, > 2): Library not loaded: libmysqlclient.18.dylib > Referenced from: > /Users/dally/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_ > mysql.so > Reason: image not found > > Does anyone have any ideas on how to fix this problem? Any help will be > greatly appreciated!
If you installed the MySQL client libraries from a MySQL binary installer, chances are that the library name in the client library does not contain the full path. The MySQL project has a pretty dismal record for releasing faulty OS X binaries. There are a few workarounds, the best being either to use install_name_tool to fix the path or to set the DYLD_LIBRARY_PATH environment variable. See, for example, this blog post: http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on- mac-os-x/ -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list