0

in python, import MySQLdb

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient.18.dylib
  Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so
  Reason: image not found

I try ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib and other solutions but nothing help.

My computer is OS X El Capitan, python2.7.9 django1.8.2 mysql-5-7-15

Cœur
  • 37,241
  • 25
  • 195
  • 267
Yun Shen
  • 33
  • 5
  • 1
    your `ln` is backwards. the syntax is `ln -s realfile linkfile`. if your libmysqlclient library is in /usr/lib, then you'd want `ln -s /usr/lib/... /usr/local/mysql/...` – Marc B Sep 20 '16 at 15:17

1 Answers1

0

I'm using ubuntu 16.04 and I don't have that lib in the same place as you specified.

The best solution for me was installing the mysql pip package with the --no-binary option as shown in this post reply

Community
  • 1
  • 1
Madox
  • 665
  • 1
  • 6
  • 14