The Blog / Development / MySQL python inside of virtualenv with django

MySQL python inside of virtualenv with django

06 Oct 2011

After hours of trying to install MySQLdb in a virtualenv for a django app I am working on, I have finally worked out how to get it done. I was using the normal

pip install MySQL-python

command inside of my environment and this didn't work, I did multiple google searches and checked all over the internet and to no avail.

I then realized that somehow something on my system was corrupt and not allowing me to install MySQLdb, I did a search for it on my system with a simple grep command. I found it was already installed globally on my system but not in the usual

/etc/lib/python2.*

directory but in

/etc/share/pyshared

It was originally installed with apt-get rather than python setuptools. What I then did was to create a file in my virtualenv site-packages directory called mysql.pth and in that directory I pointed to the location where MySQLdb was installed.

And that solved my issue, I am still checking to find the real reason why pip install doesn't seem to work installing any packages that needs compiling in my virtual environments.

Social Media

Twitter
London Midland Train Train Power Plug Square Bob Sponge Pants at o2 Arena