This is a method to switch the environment variable PYTHONPATH for each virtualenv when the Python environment is managed using virtualenv.
Add the following two lines to virtualenv_home / your_env / bin / activate
.
activate
export OLD_PYTHONPATH=$PYTHONPATH
export PYTHONPATH="/path/to/you/want"
Add the following two lines to virtualenv_home / your_env / bin / postdeactivate
.
postdeactivate
export PYTHONPATH=$OLD_PYTHONPATH
unset OLD_PYTHONPATH