Mac pip install mysql-python unsuccessful

Installing of an older version of the MySQL worked for me:

brew remove mysql
brew install [email protected]
brew link --force [email protected]
pip install mysql-python

See:

  • issue on the MySQLdb1 Github
  • and this sof answer

brew install [email protected]
export PATH="/usr/local/Cellar/[email protected]/5.7.29/bin:$PATH"
export LDFLAGS="-L/usr/local/Cellar/[email protected]/5.7.29/lib -L/usr/local/Cellar/[email protected]/1.1.1d/lib"
export CPPFLAGS="-I/usr/local/Cellar/[email protected]/5.7.29/include -I/usr/local/Cellar/[email protected]/1.1.1d/include"
/Users/tivanli/source/bk_project/pizza/venv/bin/pip install MySQL-python==1.2.5

Please, try:

CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install -r requirements.txt

If it does not work: First install mysql-connector-c

brew install mysql-connector-c 
pip install MySQL-python

If you are using Windows:

https://dev.mysql.com/downloads/connector/c/

You can also check what happend when you try install it with pip3.

UPDATE: If you have Linux: Please open the /usr/local/bin/mysql_config.

And then:

#Create options
Libs = "-L $ pkglibdir "
Libs = " $ libs   -l"

replace with:

#Create options
Libs = "- L $ pkglibdir"
Libs = "$ libs -lmysqlclient -lssl -lcrypto"

Save it and reinstall mysql-python.

pip uninstall mysql-python
pip install mysql-python

For Mac:

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

should be helpful.