Python calls the MySQLdb library, and an error “Library not loaded: libmysqlclient.18.dylib” is reported

Error message:

“…Library not loaded: libmysqlclient.18.dylib

Referenced from: …ython2.7/site-packages/
  Reason: image not found”

the reason:

After upgrading MySQL, libmysqlclient.18.dylib becomes libmysqlclient.20.dylib.


Find mysql lib under the installation path of libmysqlclient.20.dylibestablishing a soft connection.

sudo ln -s /usr/local/mysql/lib/libmysqlclient.20.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib

Read More:

Leave a Reply

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