Python: virtualenv - gtk-2.0
Question: To add gtk-2.0 to my virtualenv I did the following:

    
    
    $ virtualenv --no-site-packages --python=/usr/bin/python2.6 myvirtualenv
    $ cd myvirtualenv
    $ source bin/activate
    $ cd lib/python2.6/
    $ ln -s /usr/lib/pymodules/python2.6/gtk-2.0/ 
    

<http://stackoverflow.com/questions/249283/virtualenv-on-ubuntu-with-no-site-
packages>

Now in the Python interpreter when I do import gtk it says: No module named
gtk. When I start the interpreter with sudo it works.

Any reason why I need to use sudo and is there a way to prevent it?

**Update:**  
Forgot to mention that cairo and pygtk work but it's not the one I need.

**Update2:**  
Here the directory to show that I ain't crazy. ![](http://www.friendly-
stranger.com/pictures/symlink.jpg)


Answer: `sudo python` imports it just fine because that interpreter isn't using your
virtual environment. So don't do that.

You only linked in one of the necessary items. Do the others mentioned in the
answer to the question you linked as well.

(The pygtk.pth file is of particular importance, since it tells python to
actually put that directory you linked onto the python path)

## Update

Put that stuff in $VIRTUALENV/lib/python2.6/**site-packages/** rather than the
directory above that.

Looks like the .pth files aren't read from that directory - just from site-
packages

