I created an virtualenv with virtualenvwrapper:
mkvirtualenv test --no-site-packages workon test cdvirtualenv
Then I created a simple script named testme.py:
#!/usr/bin/env python import pygtk
Result:
$ python testme.py Traceback (most recent call last): File "testme.py", line 3, in <module> import pygtk ImportError: No module named pygtk
I tried this now many times and different ways but nothing worked...
Here is what I have done already:
- Try to install it with pip:
Command "python setup.py egg_info" failed with error code 1
Install ruamel.venvgtk inside the virtualenv (https://pypi.python.org/pypi/ruamel.venvgtk/0.4.1)
Link it directly (and add path):
mkdir -p lib/python2.7/dist-packages/ ln -s /usr/lib/python2.7/dist-packages/gtk-2.0 lib/python2.7/dist-packages/ ln -s /usr/lib/python2.7/dist-packages/gobject lib/python2.7/dist-packages/ ln -s /usr/lib/python2.7/dist-packages/glib lib/python2.7/dist-packages/ ln -s /usr/lib/python2.7/dist-packages/cairo lib/python2.7/dist-packages/ add2virtualenv lib/python2.7/dist-packages/
- Link it to the site-packages from sys.path:
ln -s /usr/lib/python2.7/dist-packages/gtk-2.0 lib/python2.7/site-packages/ ln -s /usr/lib/python2.7/dist-packages/gobject lib/python2.7/site-packages/ ln -s /usr/lib/python2.7/dist-packages/glib lib/python2.7/site-packages/ ln -s /usr/lib/python2.7/dist-packages/cairo lib/python2.7/site-packages/
I tried it now so many time. Could get it run 1 time, but could not reproduce it.
edit: I forgot to link pygtk itself.
ln -s /usr/lib/python2.7/dist-packages/pygtk.py lib/python2.7/site-packages/