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.

Tweeties

  1. 23 Feb 2012 - RT @lewisnorth: Just added a couple of bits to @methodandclass tumblr feed: http://t.co/OGGm3ZSS via MetroTwit
  2. 22 Feb 2012 - @jelmer_fuel no problem. I thought your twitter account was about fuel related stuff. I shall go to the issue tracker the next time. via MetroTwit
  3. 22 Feb 2012 - @jelmer_fuel since when did stating something become complaining? via Twitter for Android
  4. 22 Feb 2012 - @jelmer_fuel first place I normally check is docs then forum then codebase. Issue tracker isn't on my list, I will start looking there now. via Twitter for Android

Social Media

Twitter
Square Bob Sponge Pants at Home Square Bob Sponge Pants at o2 Arena Palace Guard