I recently faced this error while installing mysql-python on my MAC machine.

EnvironmentError: mysql_config not found

mysql python
mysql python

There are two steps to resolve this error. First make sure you have mysql installed. If mysql is not installed, Install mysql and then in your bashrc add the path to your mysql installation. Once these steps are accomplished you’d be able to resolve the above mentioned “mysql_config not found error“. As I am using Mac OSX Yosemite, This article will show the steps to resolve this error on a mac running on OSX Yosemite. So without further ado let’s resolve the mysql-python error above.

Steps to install mysql-python and resolve mysql_config not found:

1. The first step is to install mysql. Run the following command on your mac machine to install mysql.

2. Once this is done add mysql to the path environment variable by running the following command

3. And now finally install mysql-python via pip using the following command

Some optional steps

If you would like to add mysql to your path environment variable then open your .bashrc file:

and add the following code:

For ZSH Users
If you use oh-my-zsh then instead of updating the .bashrc file add the above line to your .zshrc file which is located at ~/.zshrc.