Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether a given Python Environment is a Pipenv

Tags:

python

pipenv

Currently Pipenv can be used in a directory to check whether we have a corresponding pipenv environment or not (e.g. pipenv --py).

Is there a similar API to determine whether a given interpreter is a pipenv?

like image 814
Don Avatar asked Apr 27 '26 04:04

Don


1 Answers

From within a Pipenv shell, you can run 'pip -V' which will show you the path to the pip version you're using -- which will include the virtual environment path, and the Python interpreter.

For example:

pipenv shell

Produces:

Spawning environment shell (/bin/bash). Use 'exit' to leave.
~/$ . /home/<username>/.local/share/virtualenvs/projects-6W-pCI0A/bin/activate

Then, from within the Pipenv shell, running

pip -V

Gives:

pip 10.0.1 from /home/<username>/.local/share/virtualenvs/projects-6W-pCI0A/local/lib/python2.7/site-packages/pip (python 2.7)

Of course, your username would replace <username>, and your current working directory would replace mine (projects)

like image 192
ascourtas Avatar answered Apr 29 '26 17:04

ascourtas