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)
Установка PyGtk в virtualenv