Stratos Gerakakis

Mysql Bindings in Django

Tagged as: python  mysql  django 

Dec 25 2011

In order to correctly install mysql bindings in a Django virtualenv you need:

First install some Ubuntu dependencies::

$ sudo aptitude install build-essential python-mysqldb libmysqlclient-dev

Then create the virtual env and install the python packages::

$ virtualenv --no-site-packages --distribute myVirtualEnv
$ pip install -E myVirtualEnv Django
$ pip install -E myVirtualEnv mysql-python

I was missing the libmysqlclient-dev package and I was getting a EnvironmentError: mysql_config not found when running the pip install mysql-python.