我使用以下命令创建了一个环境:virtualenv venv——distribute

使用以下命令无法删除:rmvirtualenv venv - 这是virtualenvwrapper的一部分,如下面的virtualenvwrapper的答案所述

我在我的当前目录中做了一个l_1,我仍然看到venv

我可以删除它的唯一方法似乎是:sudo rm -rf venv

注意,环境不是活动的。我运行的是Ubuntu 11.10。什么好主意吗?我试过重启系统,但没有成功。


当前回答

您可以按照以下步骤删除与virtualenv相关的所有文件,然后重新安装virtualenv并使用它

cd {python virtualenv folder}

find {broken virtualenv}/ -type l                             ## to list out all the links

deactivate                                           ## deactivate if virtualenv is active

find {broken virtualenv}/ -type l -delete                    ## to delete the broken links

virtualenv {broken virtualenv} --python=python3           ## recreate links to OS's python

workon {broken virtualenv}                       ## activate & workon the fixed virtualenv

pip3 install  ... {other packages required for the project}

其他回答

您可以按照以下步骤删除与virtualenv相关的所有文件,然后重新安装virtualenv并使用它

cd {python virtualenv folder}

find {broken virtualenv}/ -type l                             ## to list out all the links

deactivate                                           ## deactivate if virtualenv is active

find {broken virtualenv}/ -type l -delete                    ## to delete the broken links

virtualenv {broken virtualenv} --python=python3           ## recreate links to OS's python

workon {broken virtualenv}                       ## activate & workon the fixed virtualenv

pip3 install  ... {other packages required for the project}

来自virtualenv的官方文件https://virtualenv.pypa.io/en/latest/user_guide.html

移除环境 删除虚拟环境只需停用它并删除环境文件夹及其所有内容: (ENV)禁用 $ rm -r /path/to/ENV .使用实例

如果你正在使用pyenv,可以删除你的虚拟环境:

$ pyenv virtualenv-delete <name>

如果你是windows用户,你也可以通过以下路径删除环境:C:/Users/username/Anaconda3/envs在这里你可以看到一个虚拟环境列表,并删除你不再需要的那个。

只需使用蟒蛇领航员删除选定的环境。