➜ ~ pip3 install mysql-connector-python
➜ ~ pip3 install mysqlclient
➜ ~ python3 -c 'import MySQLdb'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.21.dylib
Referenced from: /usr/local/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
➜ lib git:(master) ✗ pwd
/usr/local/mysql/lib
➜ lib git:(master) ✗ ls
libcrypto.1.1.dylib libmysqlclient.dylib libprotobuf.3.6.1.dylib mecab
libcrypto.dylib libmysqlservices.a libprotobuf.dylib pkgconfig
libmysqlclient.21.dylib libprotobuf-lite.3.6.1.dylib libssl.1.1.dylib plugin
libmysqlclient.a libprotobuf-lite.dylib libssl.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient.21.dylib /usr/lib/libmysqlclient.21.dylib
sudo ln -s /usr/local/mysql/lib/libssl.1.1.dylib /usr/lib/libssl.1.1.dylib
sudo ln -s /usr/local/mysql/lib/libcrypto.1.1.dylib /usr/lib/libcrypto.1.1.dylib
sudo ln -s /usr/lib/libmysqlclient.21.dylib /usr/local/mysql/lib/libmysqlclient.21.dylib
sudo ln -s /usr/lib/libssl.1.1.dylib /usr/local/mysql/lib/libssl.1.1.dylib
sudo ln -s /usr/lib/libcrypto.1.1.dylib /usr/local/mysql/lib/libcrypto.1.1.dylib