如何删除我的 anaconda 环境?

How can I remove my anaconda environment?

我在 Mac OS X 中工作。我创建了一个名为 python2env 的 conda 环境。你可以在这里看到它:

conda info --envs
# conda environments:
#
python2env               /Users/user/anaconda/envs/python2env
..
root                  *  /Users/user/anaconda

我尝试了以下命令来删除它:

conda env remove --name python2env

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

然后,我检查它是否已被删除:

conda info --envs
# conda environments:
#
python2env               /Users/user/anaconda/envs/python2env
..
root                  *  /Users/user/anaconda

但它仍然存在!

我尝试了 conda remove --name python2env --all 但无济于事。环境依旧在列。

如何删除我的 Anaconda 环境?

根据 jentjr 的建议更新:

~ conda remove --name python2env --all --debug

DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'
DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

DEBUG conda.gateways.disk.permissions:make_writable(36): tried make writable but failed: /Users/user/anaconda/envs/python2env/static/css/img/igv_logo_letters_paths.svg
PermissionError(1, 'Operation not permitted')

~ conda remove -p /Users/user/anaconda/envs/python2env --all --debug 
DEBUG conda.gateways.disk.test:prefix_is_writable(65): testing write access for prefix '/Users/user/anaconda' using path '/Users/user/anaconda/conda-meta/history'

Remove all packages in environment /Users/user/anaconda/envs/python2env:

Proceed ([y]/n)? y

DEBUG conda.gateways.disk.permissions:make_writable(36): tried make writable but failed: /Users/user/anaconda/envs/python2env/static/css/img/igv_logo_letters_paths.svg
PermissionError(1, 'Operation not permitted')
INFO conda.gateways.disk.delete:rm_rf(59): rm_rf failed for /Users/user/anaconda/envs/python2env

使用 --debug 或指定环境的完整路径都无法将其删除。我将尝试使用 chmod 使环境可写,再试一次并更新我的 post.

与环境目录中的 conda-meta 文件夹有类似的问题,并用 rm -rf [full-path-to-conda-env] 解决了它。

如果我想删除整个环境,我通常使用 conda env remove -n [name]