I'm learning django and just installed pipenv via pip install pipenv
and then pipenv shell
and I notice that the virtual environment files are installed or created in some random default directory, I have two questions regarding this:
1) How can I customize that installation/creation directory for the virtual environment? Do I have to use a different command line from pipenv shell
?
2) Can you have multiple folders with different virtual environments inside each folder/project?
According to the pipenv advanced readme (https://github.com/pypa/pipenv/blob/master/docs/advanced.rst#-custom-virtual-environment-location):
You can set the environment variable WORKON_HOME
to whichever directory you want,
e.g.: by setting export WORKON_HOME=~/.venvs
in your .bashrc file (if you are using bash).
According to this https://github.com/pypa/pipenv/issues/1071#issuecomment-370561179 comment (from the pipenv github repo), you can use a workaround for achieving this:
To be super clear, you can still get your own custom environments set up just by sourcing virtualenvs.
virtualenv 35 --python=python3.5 virtualenv 36 --python=python3.6 source 35/bin/activate && pipenv install source 36/bin/activate && pipenv install source 35/bin/activate && pipenv run <whatever>
a tiny bit of additional visual clutter to the commands but is pretty straightforward.
You would execute the virtualenv x
commands inside the project folder.