Installing mysqlclient Python module on macOS Mojave requires mysql-client and SSL library to be available on the host.
Following steps can be performed to achieve this:
- Install
opensslusingbrew install openssl - The above step should result in the
openssllibraries to be placed in/usr/local/opt/openssl/lib/. You need to add that path toLIBRARY_PATH.export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ - Install
mysql-clientusingbrew install mysql-clientThis should place themysql-clientbinaries under/usr/local/Cellar/mysql-client/ - Add location of
mysql-clientto thePATH. For example,export PATH=/usr/local/Cellar/mysql-client/8.0.18/bin:$PATH - Install
mysqlclientin your virtualenv usingpip install mysqlclient