pygtk cannot be installed in your virtualenv from PyPI, so
pip install pygtk
will download but not install. You can go through the hoops of downloading tar files and compiling and installing them, but if itβs ok to link to the appropriate packages installed on the system, activate your virtualenv and install ruamel.venvgtk enough:
pip install ruamel.venvgtk
This is a shameless plugin for my own work, none of the other solutions here worked well with the re-creation of a virtual virtual disk, such as the one made by tox .
In setup.py packages, the following happens:
try: import gtk except ImportError: print('--------------') import subprocess instdir = subprocess.check_output([ '/usr/bin/python', '-c', 'import os, pygtk; print os.path.dirname(pygtk.__file__)', ]).strip() for dst_base in sys.path: if dst_base.strip(): break for d in [ 'pygtk.pth', 'pygtk.py', 'gtk-2.0', 'gobject', 'glib', 'cairo', ]: src = os.path.join(instdir, d) dst = os.path.join(dst_base, d) if os.path.exists(src) and not os.path.exists(dst): print('linking', d, 'to', dst_base) os.symlink(src, dst)
that is, the python system is asked where pygtk is installed (on Linux Mint 17.1 it is /usr/lib/python2.7/dist-packages ), and then the links are configured on the first path (i.e. non-zero length) for the activated python.
Anthon Dec 14 '14 at 16:29 2014-12-14 16:29
source share