Fix Python – Revert the `–no-site-packages` option with virtualenv


Asked By – Olivier Verdier

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.

Now we will see solution for issue: Revert the `–no-site-packages` option with virtualenv


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

Where venv is the name of your virtual environment, and python3.4 corresponds to whichever version of python involved, for example:

$ rm venv/lib/python3.4/no-global-site-packages.txt

And if you change your mind and want to put it back:

$ touch venv/lib/python3.4/no-global-site-packages.txt

Note: If you don’t see the above file, then you have a newer version of virtualenv. You’ll want to follow this answer instead

This question is answered By – ars

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0