如何列出Linux中的所有python虚拟环境? [英] How to list all python virtual environments in Linux?

查看:2121
本文介绍了如何列出Linux中的所有python虚拟环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Debian OS中配置了多个Python环境.有没有办法列出Linux中所有已配置的环境?

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

这与下面的注释中指出的可能重复项不同.我的意思是仅使用virtualenv创建的虚拟环境.

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

推荐答案

如果仅使用低级的virtualenv ...{directory}来创建virtualenv,则仅在其中包含该特定环境的某个目录中.您只能通过在$HOME目录(或您可能用于创建virtualenvs的任何其他目录列表)上运行find来列出"这些内容,以查找python安装.希望遵循一些约定,例如将它们全部存储在~/virtualenvs中. (另请参见在何处创建virtualenvs?)

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? )

如果使用virtualenvwrapper,则如前所述,使用命令lsvirtualenv列出使用mkvirtualenv创建的环境.默认情况下,它们都在~/.virtualenvs中.请参见 https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html

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

如果使用conda,则可以使用conda info --envsconda env list列出通过conda create --name {my_env} [...]创建的虚拟环境.请参见 https://conda.io/docs/using/envs.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

这篇关于如何列出Linux中的所有python虚拟环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆