Why do you need to set the WORKON_HOME environment variable?

I did not use my python / virtual environments at that time, but I also have a virtualenvironment shell.

My question is: on the doc page this says:

export WORKON_HOME=~/Envs $ mkdir -p $WORKON_HOME $ source /usr/local/bin/virtualenvwrapper.sh $ mkvirtualenv env1 

I just did this at my invitation:

 source /usr/local/bin/virutalenvwrapper.sh 

And now I can list and select the environment by doing:

 >workon >workon envtest1 

My question is, since this works for me, I am confused, why should I create an WORKON_HOME environment variable and point it to the ~ / Envs folder? What does it do and how do they work perfectly? I don't have this / Envs folder (I know the script creates it).

Link: http://virtualenvwrapper.readthedocs.org/en/latest/

+7
source share
2 answers

If WORKON_HOME not set, the default virtualenv default folder will be set to ~/.virtualenvs
(see virtualenvwrapper.sh l.118 )

You can also use WORKON_HOME to WORKON_HOME pip which folder to use ( export PIP_VIRTUALENV_BASE=$WORKON_HOME )

source: virtualenvwrapper.readthedocs.org: binding to virtual machine support

+8
source

I am confused, why should I create an environment variable WORKON_HOME and point it to the ~ / Envs folder?

It's not obligatory. You are confused (like me) because the documentation is confused.

What does it do, and why do my work work fine?

It tells virtualenvwrapper which folder to look for in a Python environment. The workon command workon for the workon path if it is defined, or ~/.virtualenvs if it is not, so it works by default.

A use case for defining another WORKON_HOME directory WORKON_HOME be if you have different environments that you want to use for virtualenvwrapper . For example, if you back up virtual env to a different folder or have several users who want to maintain their own environments.

0
source

All Articles