Python 如何从 macOS 完全卸载 Anaconda

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42182706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 21:20:58  来源:igfitidea点击:

How to uninstall Anaconda completely from macOS

pythonmacosanacondauninstall

提问by Jordan Baron

How can I completely uninstall Anaconda from MacOS Sierra and revert back to the original Python? I have tried using conda-clean -yesbut that doesn't work. I also remove the stuff in ~/.bash_profilebut it still uses the Anaconda python and I can still run the condacommand.

如何从 MacOS Sierra 完全卸载 Anaconda 并恢复到原始 Python?我试过使用,conda-clean -yes但这不起作用。我也删除了里面的东西,~/.bash_profile但它仍然使用 Anaconda python,我仍然可以运行conda命令。

回答by jkysam

To remove the configs:

要删除配置:

conda install anaconda-clean
anaconda-clean --yes

Once the configs are removed you can delete the anaconda install folder, which is usually under your home dir:

删除配置后,您可以删除 anaconda 安装文件夹,该文件夹通常位于您的主目录下:

rm -rf ~/anaconda3

Also, the anaconda-clean --yescommand creates a backup in your home directory of the format ~/.anaconda_backup/<timestamp>. Make sure to delete that one also.

此外,该anaconda-clean --yes命令会在您的主目录中创建一个格式为~/.anaconda_backup/<timestamp>. 确保也删除那个。



EDIT (v5.2.0): Now if you want to clean all, you will also have to delete the two last lines added to your .bash_profile. They look like:

编辑(v5.2.0):现在如果你想清理所有内容,你还必须删除添加到你的.bash_profile. 他们看着像是:

# added by Anaconda3 5.2.0 installer
export PATH="/Users/ody/anaconda3/bin:$PATH"

回答by gogasca

To uninstall Anaconda open a terminal window:

要卸载 Anaconda,请打开终端窗口:

  1. Remove the entire anacondainstallation directory:
  1. 删除整个anaconda安装目录:
rm -rf ~/anaconda
  1. Edit ~/.bash_profileand remove the anaconda directory from your PATHenvironment variable.
  1. 编辑~/.bash_profile并从PATH环境变量中删除 anaconda 目录。

Note:You may need to edit .bashrcand/or .profilefiles instead of .bash_profile

注意:您可能需要编辑.bashrc和/或.profile文件而不是.bash_profile

  1. Remove the following hidden files and directories, which may have been created in the home directory:

    • .condarc
    • .conda
    • .continuum
  1. 删除以下可能已在主目录中创建的隐藏文件和目录:

    • .condarc
    • .conda
    • .continuum

Use:

用:

rm -rf ~/.condarc ~/.conda ~/.continuum

回答by Monika Bozhinova

Open the terminal and remove your entire Anaconda directory, which will have a name such as “anaconda2” or “anaconda3”, by entering the following command: rm -rf ~/anaconda3. Then remove conda with command "conda uninstall" https://conda.io/docs/commands/conda-uninstall.html.

打开终端并通过输入以下命令删除整个 Anaconda 目录,该目录将具有诸如“anaconda2”或“anaconda3”之类的名称:rm -rf ~/anaconda3。然后使用命令“conda uninstall”删除 conda https://conda.io/docs/commands/conda-uninstall.html

回答by Laknath

In my case (Mac High Sierra) it was installed at ~/opt/anaconda3.

就我而言(Mac High Sierra),它安装在 ~/opt/anaconda3。

https://docs.anaconda.com/anaconda/install/uninstall/

https://docs.anaconda.com/anaconda/install/uninstall/

回答by jstamis

This is one more place that anaconda had an entry that was breaking my python install after removing Anaconda. Hoping this helps someone else.

这是 anaconda 有一个条目在删除 Anaconda 后破坏了我的 python 安装的另一个地方。希望这对其他人有所帮助。

If you are using yarn, I found this entry in my .yarn.rc file in ~/"username"

如果您使用的是纱线,我会在 ~/"username" 的 .yarn.rc 文件中找到此条目

python "/Users/someone/anaconda3/bin/python3"

蟒蛇“/用户/某人/anaconda3/bin/python3”

removing this line fixed one last place needed for complete removal. I am not sure how that entry was added but it helped

删除此行修复了完全删除所需的最后一个位置。我不确定该条目是如何添加的,但它有帮助

回答by riot

After performing the very helpful suggestions from both spicyramen & jkysam without immediate success, a simple restart of my Mac was needed to make the system recognize the changes. Hope this helps someone!

在执行了辛辣拉面和 jkysam 的非常有用的建议但没有立即成功之后,需要简单地重新启动我的 Mac 以使系统识别更改。希望这可以帮助某人!

回答by StOchastiC_

Adding export PATH="/Users/<username>/anaconda/bin:$PATH"(or export PATH="/Users/<username>/anaconda3/bin:$PATH"if you have anaconda 3) to my ~/.bash_profile file, fixed this issue for me.

添加export PATH="/Users/<username>/anaconda/bin:$PATH"(或者export PATH="/Users/<username>/anaconda3/bin:$PATH"如果你有 anaconda 3)到我的 ~/.bash_profile 文件,为我解决了这个问题。

回答by Charlie Parker

The official instructions seem to be here: https://docs.anaconda.com/anaconda/install/uninstall/

官方说明似乎在这里:https: //docs.anaconda.com/anaconda/install/uninstall/

but if you like me that didn't work for some reason and for some reason your conda was installed somewhere else with telling you do this:

但是,如果您喜欢我因为某种原因而不起作用,并且由于某种原因您的 conda 安装在其他地方并告诉您这样做:

rm -rf ~/opt

I have no idea why it was saved there but that's what did it for me.

我不知道为什么它会保存在那里,但这就是为我所做的。



This was useful to me in fixing my conda installation (if that is the reason you are uninstalling it in the first place like me): https://stackoverflow.com/a/60902863/1601580that ended up fixing it for me. Not sure why conda was acting weird in the first place or installing things wrongly in the first place though...

这对我修复我的 conda 安装很有用(如果这就是你像我一样首先卸载它的原因):https: //stackoverflow.com/a/60902863/1601580最终为我修复了它。不知道为什么 conda 一开始就表现得很奇怪,或者一开始就安装错误......

回答by localhost

This has worked for me:

这对我有用:

conda remove --all --prefix /Users/username/anaconda/bin/python

then also remove from $PATH in .bash_profile

然后也从 .bash_profile 中的 $PATH 中删除