python virtualenv: why can I still import old modules in clean/new virtualenv
Question: I'm starting a new Python project, and I want to work with **virtualenv** to
have a clean start. After setting one up though, I can still import old
modules that I have not installed for the new virtualenv - why?

I created one with:

    
    
    virtualenv ~/virtualenvs/mynewproject --no-site-packages
    

now i activate with `source bin/activate`

Now when I start a python interpreter (by just typing `python`), I thought
that it will use the python interpreter in my virtualenv, and my pythonpath
would have been set to the site-packages path of my virutalenv's python
(/virtualenvs/mynewporject/lib/python2.7/site-packages), and nothing else.

However, when I look at sys.path, all the old, system-wide packages are
available, and I can import them fine - which is what I don't want.

What am I missing here?


Answer: Check your `PYTHONPATH` environment variable which probably points to where
you have the older version of your package. This variable always comes first
in your `sys.path` so make sure you either clear it or change it to point to
the virtualenv which you activate.

