Get path of virtual environment in pipenv

How to can get the path of virtualenv in pipenv?

can configure it to use a custom path for newly created virtualenv?


Solution 1:

The following should give you the paths

$ pipenv --where
/home/wonder/workspace/myproj
$ pipenv --venv
/home/wonder/PyEnvs/myproj-BKbQCeJj

Solution 2:

Adding to Sewagodimo Matlapeng's answer for the second part of the question:

can configure it to use a custom path for newly created virtualenv?

According to documentation, you can set the base location for the virtualenvs with the environment variable WORKON_HOME. If you want to place the virtualenv specifically in <project>/.venv, set the environment variable PIPENV_VENV_IN_PROJECT.

e.g., running:

export WORKON_HOME=/tmp
pipenv install

Would place the virtualenv in /tmp/<projectname>-<hash>.