'pip install MySQL-python' fails with 'IndexError' 'pip install MySQL-python' fails with 'IndexError' python python

'pip install MySQL-python' fails with 'IndexError'


Copy from this blog.

By finding out the information that mysql-connector-cmight come to the conclusion that the configuration by brew installation may be incorrect , open the /usr/local/bin/mysql_config script to modify some of the contents of it:

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

change into:

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

Save
Then re-install mysql-python:

pip install mysql-python


I met same error and solved with following instructions:

  1. brew uninstall mysql-connector-c
  2. brew install mysql
  3. invoke "mysql_config --libs" and confirm its output include correct library options: "-L/usr/local/Cellar/mysql/5.7.20/lib -lmysqlclient -lssl -lcrypto"
  4. export LDFLAGS=-L/usr/local/opt/openssl/lib && pip install mysqlclient


This solved my issue:

     brew install mysql@5.7     brew link --force mysql@5.7