Reputation: 543
How do you list all Pipenv environments like virtualenv's lsvirtualenv command? The documentation does not say how. Thanks a lot to all for the help given. Cheers!
Upvotes: 34
Views: 48413
Reputation:
In my case, since I don't know a way to list all my virtual environments using any pipenv
option, what I do is list the folder where all the virtual environments are.
In Ubuntu by default, pipenv
creates a folder in $HOME/.local/share/virtualenvs/
with the name of the virtual env, then listing that folder I have a list of all my environments.
To make life easier, I have created an alias to perform this operation.
Upvotes: 3
Reputation: 1649
You can add the following alias to .bash_aliases
:
alias pipenv-list='for venv in ~/.local/share/virtualenvs/* ; do basename $venv; cat $venv/.project | sed "s/\(.*\)/\t\1\n/" ; done'
This will list all the virtual environments and the corresponding project (source) folder like:
$ pipenv-list
<PIPENV>
<PROJECT_HOME_DIR>
[...]
Upvotes: 11
Reputation: 501
Why not simply looking for existing virtual environments? To check where they are stored you can activate one virtual env and get its path:
$pipenv shell
$pipenv --venv
> /path/to/existing_venvs/current_venv
ls /path/to/existing_venvs/
> cython-pr4GGvfQ/ openCV-f4drK-E5/
I don't know if pipenv can store venvs in other places, but at least for me this is enough to know how many and which venvs I have.
Upvotes: 25
Reputation: 31
As AChampion said, pipenv has no lsvirtualenv or similar functions.
The creator of pipenv, Kenneth Reitz, told here that is not planned to implement anything of the sort, and that people should rely in other tools like pew.
I've tried pew and pipes and both are good tools, but not the exact tools I was looking for my workflow, so for my personal use I built pipenvwrapper using the base code of virtualenvwrapper.
Some of the supported functions of pipenvwrapper are: workon, lsvirtualenv, cdproject, cdvirtualenv, cdsitepackages, mkproject and rmvirtualenv.
Check if any of those 3 tools fit your needs.
Upvotes: 3