Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all python virtual environments in Linux? [duplicate]

I have more than one Python environment configured in my Debian OS. Is there a way to list all configured environments in Linux?

This is different from the possible duplicate as indicated in the comment below. I mean virtual environments created using virtualenv only.

like image 692
AhmedWas Avatar asked Sep 28 '16 10:09

AhmedWas


People also ask

How do I see all Python environments?

To see a list of the Python virtual environments that you have created, you can use the 'conda env list' command. This command will give you the names as well as the filesystem paths for the location of your virtual environments.

How do I get a list of VENV?

You can use the lsvirtualenv , in which you have two options "long" or "brief": "long" option is the default one, it searches for any hook you may have around this command and executes it, which takes more time. "brief" just take the virtualenvs names and prints it.

Can I copy virtualenv?

virtualenv-clone will be installed inside newenv. Now while logged-in as newenv we can create a copy of any existing environment. For example creating the copy of ProjectAenv: (newenv): virtualenv-clone ProjectAenv ProjectBenv (newenv): deactivate # to come out from newenv.


1 Answers

If only using the lowly virtualenv ...{directory} to create a virtualenv, then there is just some directory somewhere that has that specific environment in it. You can only "list" these by running find on your $HOME directory (or any other list of directories you might have used to create virtualenvs) looking for python installations. Hopefully some convention was followed like storing them all in ~/virtualenvs. (See also Where should virtualenvs be created? )

If using virtualenvwrapper, then as mentioned, use the command lsvirtualenv to list envs that were created with mkvirtualenv. They are all in ~/.virtualenvs by default. See https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html

If using conda, you can list virtual envs created via conda create --name {my_env} [...], using either conda info --envs or conda env list. See https://conda.io/docs/using/envs.html#list-all-environments

like image 58
michael Avatar answered Oct 02 '22 18:10

michael