views:

51

answers:

2

I have created a virtualenv using the --no-site-packages option and installed lots of libraries. Now I would like to revert the --no-site-packages option and use also the global packages.

Can I do that without recreating the virtualenv?

More precisely:

I wonder what exactly happens when creating a virtualenv using the --no-site-packages option as opposed to not using that option.

If I know what happens then I can figure out how to undo it.

A: 

Try adding a symlink between /virtualenv_root/lib/ and /path/to/desired/site-packages/

Tim McNamara
+2  A: 

Try removing (or renaming) the file no-global-site-packages.txt in your Lib folder under your virtual environment.

ars
That will do it. The existence (or nonexistence) of that file is the only direct effect of the no-site-packages flag. Virtualenv's customized site.py looks for that file to decide whether to add global site-packages directories to sys.path.
Carl Meyer
Brilliant! That did it! Thanks a lot for that answer, and thanks to Carl Meyer for the additional comment.
Olivier