Home > Software design >  Python 2.7 looking for libmysqlclient.20.dylib but my Mac has libmysqlclient.21.dylib
Python 2.7 looking for libmysqlclient.20.dylib but my Mac has libmysqlclient.21.dylib

Time:06-15

I've done:

python -m pip uninstall MySQL-python
python -m pip install MySQL-python

Error is:

ImportError: dlopen(/Users/me/anaconda/lib/python2.7/site-packages/_mysql.so, 0x0002): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib Referenced from: /Users/me/anaconda/lib/python2.7/site-packages/_mysql.so Reason: tried: '/usr/local/opt/mysql/lib/libmysqlclient.20.dylib' (no such file), '/usr/local/lib/libmysqlclient.20.dylib' (no such file), '/usr/lib/libmysqlclient.20.dylib' (no such file), '/usr/local/Cellar/mysql/8.0.26/lib/libmysqlclient.20.dylib' (no such file), '/usr/local/lib/libmysqlclient.20.dylib' (no such file), '/usr/lib/libmysqlclient.20.dylib' (no such file)

These files exist:

/usr/local/lib/libmysqlclient.libmysqlclient.21.dylib
/usr/local/lib/libmysqlclient.a
/usr/local/lib/libmysqlclient.dylib 

How do I get the .20. version? Can I just do a soft link or are they not compatible like that?

CodePudding user response:

Pretty sure you will need to install the mysql connector using homebrew. So, firstly install homebrew if you haven't got it... Then remove MySQL-python

python -m pip uninstall MySQL-python

Then use homebrew to install the python connector for mysql.

brew install mysql-connector-c

Then install mysql for python

python -m pip install mysql-python

CodePudding user response:

The .20 version should be for MySQL 5.7 db. Can you downgrade to a version of MySQL-python that uses MySQL 5.7?

You could try to symbolic link .20 to .21 but there may be interactions that fail in doing so.

  • Related