12

I get the following error when I try to install MySQL-python within virtualenv on a MAC running 10.8.

vertualenv EnvironmentError: mysql_config not found
Glyn Jackson
  • 8,228
  • 4
  • 29
  • 52

2 Answers2

22

It's a simple fix just to edit the /bin/activate file from the virtualenv directory and add the following lines,

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
PATH="$PATH:/usr/local/mysql/bin/"
export PATH

That's it, just make sure you match your paths to your own configuration. Now MySQL-python installs under virtualenv as normal.

Link: http://glynjackson.org/weblog/entry/fix-vertualenv-environmenterror-mysql_config-not-found.html

Glyn Jackson
  • 8,228
  • 4
  • 29
  • 52
6

Also it can help you, especially if you use MacOS X

pip install MySQL-python (error)

echo "mysql_config = /usr/local/mysql/bin/mysql_config" >> ~/.virtualenvs/ENV_NAME/build/MySQL-python/site.cfg

pip install MySQL-python (it's ok)
Ellochka Cannibal
  • 1,750
  • 2
  • 19
  • 31