Get path of virtual environment in pipenv

PythonDjangoPipPipenv

Python Problem Overview


How to can get the path of virtualenv in pipenv?

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

Python Solutions


Solution 1 - Python

The following should give you the paths

$ pipenv --where
/home/wonder/workspace/myproj

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

Solution 2 - Python

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>.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionamirView Question on Stackoverflow
Solution 1 - PythonSewagodimo MatlapengView Answer on Stackoverflow
Solution 2 - PythonOmer AnsonView Answer on Stackoverflow