如何删除我的anaconda环境?

时间:2018-03-24 22:10:18

标签: python anaconda conda

我在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的avdvice:

~ 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使环境可写,再试一次并更新我的帖子。

1 个答案:

答案 0 :(得分:1)

在环境目录中的conda-meta文件夹中存在类似的问题,并通过rm -rf [full-path-to-conda-env]解决了该问题。