Virtualenv loses context

Hans Mulder hansmu at xs4all.nl
Wed Dec 19 20:21:39 CET 2012


On 19/12/12 15:38:01, rhythmicdevil at gmail.com wrote:
> Just installed a brand new virtualenv along with two packages. Ran this and I got nothing:
> 
> (venvtest)[swright at localhost venvtest]$ python -m site
> (venvtest)[swright at localhost venvtest]$ 
>
> I expected to have at least one path in sys.path

For some reason, that doesn't work with python2.7.
I guess that's a bug in 2.7.

One variant that does work, is:

    python -c 'import site; site._script();'

Another would be:

    python /usr/lib/python2.7/site.py

If you think you may have accidentally deactivated your
virtualenv, you can do:

    python -c 'import sys; print sys.executable;'

Your prompt suggests that "venvtest" is active.
However, it's possible to deactivate a virtualenv without
resetting the prompt; you may have unintentionally done that.
If that's the problem, you can solve it by sourcing the
"activate" script again.


Hope this helps,

-- HansM









More information about the Python-list mailing list