One - One Code All

Blog Content

如何安全的卸载Python Anaconda?

Python Linux-Mac   2016-08-20 09:56:26

如何安全的卸载Python Anaconda?


最佳解决方法

anaconda安装程序在~/.bash_profile脚本中新添加了一行,将anaconda bin目录添加到了$PATH环境变量中。所以你只需要删除anaconda目录,但是最好也从您的安装脚本中删除此行。


 


次佳解决方法

参考文档:


要卸载Anaconda,先打开终端窗口并删除整个anaconda安装目录:rm -rf〜/ anaconda。

然后您要编辑〜/ .bash_profile并从PATH环境变量中删除anaconda目录,并使用rm -rf ~/.condarc ~/.conda ~/.continuum删除可能在主目录中创建的隐藏的.condarc文件和.conda以及.continuum目录


 


第三种解决方案

删除Anaconda目录有用,但我不认为这是一个好主意,因为您可能需要在不久的将来再次使用anaconda。根据mwaskom的建议,anaconda安装程序将自动添加PATH变量,该变量指向~/.bashrc文件中的anaconda/bin目录。


它看起来是这样的

PATH="/home/linuxsagar/anaconda3/bin:$PATH,所以,只是注释掉行(添加#在行的开头)。然后通过执行$source ~/.bashrc重新加载~/.bashrc文件


最好,在新终端中执行$which python来验证一下更改是否有效。


 


第四种方案

rm -rf〜/anaconda


相当简单,参考:https://docs.continuum.io/anaconda/install#os-x-uninstall


 


第五种方案

软件包"anaconda clean"(可从Anaconda平台获得),需要安全卸载。


conda install anaconda-clean   # install the package anaconda clean

anaconda-clean --yes           # clean all anaconda related files and directories 

rm -rf ~/anaconda3             # removes the entire anaconda directory


rm -rf ~/.anaconda_backup       # anaconda clean creates a back_up of files/dirs, remove it 

                                # (conda list; cmd shouldn't respond after the clean up)

有关详细信息,请参阅https://docs.continuum.io/anaconda/install#uninstall-anaconda。


 


第六种方案

如果要卸载Anaconda以便能够在系统中使用默认的Python,则可以按照以下步骤临时禁用该路径,而不是卸载Anaconda。


转到你的主目录。只需一个cd命令即可。


编辑文件.bashrc。


在文件中查找类似export PATH="/home/ubuntu/anaconda3/bin:$PATH"的内容。


在开始时放置一个#来从脚本中注释它。


#export PATH="/home/ubuntu/anaconda3/bin:$PATH"

打开一个新的终端,就可以运行基本的python了。这适用于Linux系统,在Mac上也应该有效。



上一篇:python中@classmethod @staticmethod区别
下一篇:Python中collections.Counter()用法

The minute you think of giving up, think of the reason why you held on so long.