Mutant
Mutant

Reputation: 3821

python accessing mysql db not able to load the library

I am using python 2.7 and MySQLdb, while doing import MySQLdb its throwing below error -

import MySQLdb
  File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Library/Python/2.7/site-packages/_mysql.so
  Reason: image not found

Upvotes: 0

Views: 2067

Answers (1)

Chris
Chris

Reputation: 3121

You need to have the mysql client installed on your system.

If you have, then you have the file libmysqlclient.18.dylib located somewhere on your system. Make sure the path where it is located is included in your DYLD_LIBRARY_PATH environment variable.

Upvotes: 1

Related Questions