I have installed MySQLdb on El Capitan using:
brew install mysql
pip install MySQL-python
When I try python -c "import MySQLdb"
I get the following error:
File "<string>", line 1, in <module>
File "MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(./_mysql.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/<user>/anaconda/lib/python2.7/site-packages/_mysql.so
Reason: no suitable image found. Did find:
/usr/local/bin/mysql/lib/libssl.1.0.0.dylib: stat() failed with errno=20
Found some related posts but still did not figure out how to fix this. Any help is much appreciated.
EDIT:
If I decide to revert step 1 (brew uninstall mysql
) because SQLite (sqlite3) comes pre-installed with El Capitan, I get the following error message:
File "<string>", line 1, in <module>
File "/Users/<user>/anaconda/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Users/<user>/anaconda/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib
Referenced from: /Users/<user>/anaconda/lib/python2.7/site-packages/_mysql.so
Reason: image not found
What am I missing? Are the two error messages related?