Skip to content Skip to sidebar Skip to footer

Why Do You Need To Set The WORKON_HOME Environment Variable?

I haven't used my python/virtual environments in a while, but I do have virtualenvironment wrapper installed also. My question is, in the doc page it says to do this: export WORKON

Solution 1:

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

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

source : virtualenvwrapper.readthedocs.org : Tying to pip’s virtualenv support


Solution 2:

I'm confused why I should be creating an environmental variable WORKON_HOME and point it to the ~/Envs folder?

It's optional. You're confused (like I was) because the documentation is confusing.

What does that do and how come mine works fine w/o it?

It tells virtualenvwrapper which folder to search for Python environments. The command workon searches the path WORKON_HOME if it's defined, or ~/.virtualenvs if it's not, which is why it works by default.

A use case for defining a different WORKON_HOME directory would be if you have different environments you want to available to virtualenvwrapper. For example, if you save virtual env backups to a different folder or have multiple users who want to maintain their own environments.


Post a Comment for "Why Do You Need To Set The WORKON_HOME Environment Variable?"