Error installing mysql-python: library not found for -lssl

Solved it with these steps:

brew uninstall mysql
brew install mysql-connector-c
pip install mysql-python
brew unlink mysql-connector-c
brew install mysql

Found the answer here https://stackoverflow.com/a/25920020/576192

Not sure if this is the right way, but this is how I managed to solve it.


You can set ssl library path explicitly.

LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient

I tried updating Xcode's CLT, uninstalling mysql, checking mysql_config, etc., but had no luck.

I found that running brew info openssl shows:

...

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

...

Running those two commands, followed by pip install, worked for me (in my case when installing mysqlclient).