0

Trying to figure out why MySQLlib is not working on my installation. Here's the error from a script which tries to import it:

Traceback (most recent call last):
File "test.py", line 4, in <module>
import MySQLdb as mdb
File  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_mysql.so
Reason: no suitable image found.  Did find:
/Applications/mampstack-5.4.36-0/mysql/lib/libmysqlclient.18.dylib/libmysqlclient.18.dylib: stat() failed with errno=20

Before this, I had the 'image not found' error which has been commonly reported - and trying some of the different solutions there led me to this issue. Weirdly, it seems that most people who have this issue have a 'wrong architecture' error.

Does anyone have any ideas?

Community
  • 1
  • 1
jgads
  • 257
  • 1
  • 3
  • 13

1 Answers1

0

Solved it. I needed to specify the actual path, not the filename - I tried:

export DYLD_LIBRARY_PATH=/Applications/mampstack-5.4.36-0/mysql/lib/ 

Rather than:

export DYLD_LIBRARY_PATH=/Applications/mampstack-5.4.36-0/mysql/lib/libmysqlclient.18.dylib
jgads
  • 257
  • 1
  • 3
  • 13
  • I have the same issue, and have tried using the above line in terminal, but when I run my python script I get the same error. Should I be doing something else with the line above? – speedyrazor Mar 26 '15 at 07:17