Modifying a virtualenv so that packages installed in global site-packages are available

python, virtualenv, virtualenvwrapper

Solution

This question is a partial duplicate of: Revert the `--no-site-packages` option with virtualenv

However since this question specifically mentions virtualenvwrapper, the simplest solution when using virtualenvwrapper is to simply use its `toggleglobalsitepackages` command. It takes no parameters and affects only the active environment.

$ workon env1
(env1)$ toggleglobalsitepackages
Enabled global site-packages
(env1)$ toggleglobalsitepackages
Disabled global site-packages

Alternatively you can reinstall the virtualenv, reconfiguring it to have access to global packages, while keeping the packages already installed there with the command:

$ mkvirtualenv --system-site-packages env1

(thanks to @Adaephon for the heads up regarding `toggleglobalsitepackages`)

Problem

Possible Duplicate: Revert the `--no-site-packages` option with virtualenv I've created a virtual environment using the virtualenvwrapper documentation as follows: ``` $ pip install virtualenvwrapper $ export WORKON_HOME=~/Envs $ mkdir -p $WORKON_HOME $ source /usr/local/bin/virtualenvwrapper.sh $ mkvirtualenv env1 ``` It works fine for the most part, but I've run into a few Django issues that require me to install some global packages outside of my virtual environment. Once I've installed these packages, how to I update my virtual environment to pull in these new packages? Or do I need to recreate the environment from scratch?

Original source

Related problems