pip install mysql-python fails with EnvironmentError: mysql_config not found

pip install mysql-python fails with EnvironmentError: mysql_config not found

It seems mysql_config is missing on your system or the installer could not find it.
Be sure mysql_config is really installed.

For example on Debian/Ubuntu you must install the package:

sudo apt-get install libmysqlclient-dev

Maybe the mysql_config is not in your path, it will be the case when you compile by yourself
the mysql suite.

Update: For recent versions of debian/ubuntu (as of 2018) it is

sudo apt install default-libmysqlclient-dev

In Mac OS, I simply ran this in terminal to fix:

export PATH=$PATH:/usr/local/mysql/bin

This is the quickest fix I found – it adds it to the path, but I think youre better off adding it permanently (ie add it to /etc/paths) if you plan to install MySQL-python in another environment.

(tested in OSX Mountain Lion)

pip install mysql-python fails with EnvironmentError: mysql_config not found

apt-get install libmysqlclient-dev python-dev

Seemed to do the trick.

Leave a Reply

Your email address will not be published. Required fields are marked *