So I am trying to run a simple matplotlib example in my virtualenv (in the console). Here\'s the code:
import matplotlib
matplotlib.use(\'GTKAgg\')
import ma
I did this
sudo apt-get install python-gtk2
I found that it was already installed upon some investigation, i found out that when I create a virtual environment, it was missing some links so I came across this post: Virtualenv on Ubuntu with no site-packages.
I read it and tailored the commands provided to my setup as follows:
First I changed into my virtualenv and activated it by
source bin/activate
Then I changed into the lib/python2.7 folder inside my virtualenv:
cd lib/python2.7
I then executed the following commands.
$ ln -s /usr/lib/python2.7/dist-packages/cairo/
$ ln -s /usr/lib/python2.7/dist-packages/pygtk.py
$ ln -s /usr/lib/python2.7/dist-packages/pygtk.pth
$ ln -s /usr/lib/python2.7/dist-packages/gtk-2.0/
Finally, to check I typed 'python', and executed:
>>> import pygtk
It gave me no error, and therefore I knew its now available in my virtual env.
I'm using Ubuntu 14.04 (64-bit) on an intel Core i5.