0
votes

I use Jupyter notebook to connect the server, and try to 'import mySQLdb', I met some problem: ImportError: dlopen(//anaconda3/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.21.dylib Referenced from: //anaconda3/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so Reason: image not found

I used 'pip install mysql' for create the mysql environment. When I try to 'pip uninstall mysql' and use 'conda install mysql-python' it says:

The following specifications were found to be incompatible with each other:

Package certifi conflicts for: mysql-python -> python[version='>=2.7,<2.8.0a0'] -> pip -> setuptools -> certifi[version='>=2016.09'] python=3.7 -> pip -> setuptools -> certifi[version='>=2016.09'] Package wheel conflicts for: python=3.7 -> pip -> wheel mysql-python -> python[version='>=2.7,<2.8.0a0'] -> pip -> wheel Package pip conflicts for: python=3.7 -> pip mysql-python -> python[version='>=2.7,<2.8.0a0'] -> pip Package setuptools conflicts for: mysql-python -> python[version='>=2.7,<2.8.0a0'] -> pip -> setuptools python=3.7 -> pip -> setuptools Package ca-certificates conflicts for: python=3.7 -> openssl[version='>=1.1.1b,<1.1.2a'] -> ca-certificates mysql-python -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates

1
Sounds borked. Easiest solution is a reinstall. Please take time to read the best practices for "Using Pip in a Conda Env" to avoid such problems in the future.merv

1 Answers

0
votes

Ok, I solve the problem by myself! lol I just write the missing lib into the mysql 1: disable the csrutil 2: add lib: sudo ln -s /usr/local/mysql/lib/libmysqlclient.21.dylib /usr/lib/libmysqlclient.21.dylib