virtualenv – EnvironmentError: mysql_config not found

So I was setting up virtualenv, during the setup process I was having this very common(!) error when I was trying to install MySQL-python. The solution is bit tricky. Though I found solution like, setting PATH on .profile, but actually that might work for normal installation.

I am on Mac OS 10.6.8 and for me the mysql_config file was in /usr/local/mysql/bin/ directory.

Edit the /bin/activate file from the virtualenv directory and add the following lines,

export PATH

then run the following command

source virtualenvDirectory/bin/activate

this will change your path to virtualenv’s bin directory.

now try to install MySQL-python again.

and to undo the changes to $PATH

deactivate virtualenvDirectory/bin/activate

and tada!!!

5 thoughts on “virtualenv – EnvironmentError: mysql_config not found

  1. Not sure at exactly what position in active file to wrote your code snippet:

    export PATH

    System: Mac OS X Maverick, virtualenv, Pycharm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s