Python Anaconda - 如何安全卸载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22585235/
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 01:12:57  来源:igfitidea点击:

Python Anaconda - How to Safely Uninstall

pythonanaconda

提问by william tell

I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What's the best way to do this? Should I delete the ~/anacondadirectory? Any other changes required?

我在 Mac (OS Mavericks) 上安装了 Python Anaconda。我想在我的 Mac 上恢复到 Python 的默认版本。做到这一点的最佳方法是什么?我应该删除~/anaconda目录吗?还需要其他什么改动吗?

Currently when I run which pythonI get this path:

目前,当我跑步时,which python我得到了这条路径:

/Users/username/anaconda/bin/python

/Users/username/anaconda/bin/python

回答by mwaskom

The anaconda installer adds a line in your ~/.bash_profilescript that prepends the anaconda bin directory to your $PATHenvironment variable. Deleting the anaconda directory should be all you need to do, but it's good housekeeping to remove this line from your setup script too.

anaconda 安装程序会在您的~/.bash_profile脚本中添加一行,将 anaconda bin 目录添加到您的$PATH环境变量中。删除 anaconda 目录应该是您需要做的所有事情,但是从您的安装脚本中删除这一行也是很好的内务管理。

回答by sgiri

Removing the Anaconda directory helps, but I don't think that's a good idea as you might need to use anaconda sometimes in near future. So, as suggested by mwaskom, anaconda installer automatically adds PATHvariable which points to anaconda/bindirectory in the ~/.bashrcfile.

删除 Anaconda 目录会有所帮助,但我认为这不是一个好主意,因为在不久的将来有时您可能需要使用 anaconda。因此,正如mwaskom所建议的那样,anaconda 安装程序会自动添加PATH指向文件中anaconda/bin目录的变量~/.bashrc

It looks like this

看起来像这样

PATH="/home/linuxsagar/anaconda3/bin:$PATH

So, just comment out the line (add #in the beginning of the line). Then reload the ~/.bashrcfile executing source ~/.bashrc

因此,只需注释掉该行(在行首添加#)。然后重新加载~/.bashrc文件执行source ~/.bashrc

Now, verify the changes executing which pythonin the new terminal.

现在,验证which python在新终端中执行的更改。

回答by Jonathan

rm -rf ~/anaconda

It was pretty easy. It switched my pointer to Python: https://docs.continuum.io/anaconda/install#os-x-uninstall

这很容易。它将我的指针切换到 Python:https: //docs.continuum.io/anaconda/install#os-x-uninstall

回答by vaer-k

From the docs:

文档

To uninstall Anaconda open a terminal window and remove the entire anaconda install directory: rm -rf ~/anaconda. You may also edit ~/.bash_profileand remove the anaconda directory from your PATHenvironment variable, and remove the hidden .condarcfile and .condaand .continuumdirectories which may have been created in the home directory with rm -rf ~/.condarc ~/.conda ~/.continuum.

要卸载 Anaconda,请打开终端窗口并删除整个 anaconda 安装目录:rm -rf ~/anaconda. 您也可以编辑 ~/.bash_profile和删除的森蚺目录PATH的环境变量,并删除隐藏.condarc文件, .conda.continuum可能已在主目录中创建的目录rm -rf ~/.condarc ~/.conda ~/.continuum

Further notes:

补充说明:

  • Python3 installs may use a ~/anaconda3dir instead of ~/anaconda.
  • You might also have a ~/.anacondahidden directory that may be removed.
  • Depending on how you installed, it is possible that the PATHis modified in one of your runcom files, and not in your shell profile. So, for example if you are using bash, be sure to check your ~/.bashrcif you don't find the PATHmodified in ~/.bash_profile.
  • Python3 安装可能使用~/anaconda3dir 而不是~/anaconda.
  • 您可能还有一个~/.anaconda可以删除的隐藏目录。
  • 根据您的安装方式,有可能PATH在您的 runco​​m 文件之一中修改 ,而不是在您的 shell 配置文件中。因此,例如,如果您正在使用 bash,请务必检查您~/.bashrc是否PATH~/.bash_profile.

回答by Surya

Package"anaconda clean", available from Anaconda platform, should uninstall safely.

Anaconda 平台提供的“ anaconda clean应该可以安全卸载。

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)

Refer: https://docs.anaconda.com/anaconda/install/uninstallfor more details.

有关更多详细信息,请参阅:https: //docs.anaconda.com/anaconda/install/uninstall

回答by jp0d

If you're uninstalling Anaconda to be able to use the base Python installation in the system, you could temporarily disable the path by following these steps and not uninstalling Anaconda.

如果您要卸载 Anaconda 以便能够使用系统中的基本 Python 安装,您可以按照以下步骤暂时禁用该路径,而不是卸载 Anaconda。

Go to your home directory. Just a cdcommand will do.

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

Edit the file .bashrc.

编辑文件.bashrc

Look for something like export PATH="/home/ubuntu/anaconda3/bin:$PATH"in the file.

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

Put a #at the beginning to comment it from the script.

将 a#放在开头以从脚本中对其进行注释。

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

Open a new terminal and you should be running the base python installation. This works on Linux systems. Should work on Mac too.

打开一个新终端,您应该正在运行基本的 python 安装。这适用于 Linux 系统。也应该在 Mac 上工作。

回答by VectorLu

Uninstalling Anaconda

卸载 Anaconda

To uninstall Anaconda, you can do a simple remove of the program. This will leave a few files behind, which for most users is just fine. See Option A.

要卸载 Anaconda,您可以简单地删除该程序。这将留下一些文件,这对大多数用户来说很好。见选项 A。

If you also want to remove all traces of the configuration files and directories from Anaconda and its programs, you can download and use the Anaconda-Clean program first, then do a simple remove. See Option B.

如果您还想从 Anaconda 及其程序中删除所有配置文件和目录的痕迹,您可以先下载并使用 Anaconda-Clean 程序,然后进行简单的删除。见选项 B。

Option A.

选项 A。

Use simple remove to uninstall Anaconda:

使用 simple remove 卸载 Anaconda:

macOS–Open the Terminal.app or iTerm2 terminal application, and then remove your entire Anaconda directory, which has a name such as anaconda2 or anaconda3, by entering rm -rf ~/anaconda3.

macOS – 打开 Terminal.app 或 iTerm2 终端应用程序,然后输入rm -rf ~/anaconda3.

Option B.

选项 B。

Full uninstall using Anaconda-Clean and simple remove.

使用 Anaconda-Clean 完全卸载并简单删除。

NOTE: Anaconda-Clean must be run before simple remove.

注意:Anaconda-Clean 必须在简单删除之前运行。

Install the Anaconda-Clean package from Anaconda Prompt or a terminal window:

从 Anaconda Prompt 或终端窗口安装 Anaconda-Clean 包:

conda install anaconda-clean

In the same window, run one of these commands:

在同一窗口中,运行以下命令之一:

Remove all Anaconda-related files and directories with a confirmation prompt before deleting each one:

在删除每个文件和目录之前,使用确认提示删除所有与 Anaconda 相关的文件和目录:

anaconda-clean

Or, remove all Anaconda-related files and directories without being prompted to delete each one:

或者,删除所有与 Anaconda 相关的文件和目录,而不会提示删除每个文件和目录:

anaconda-clean --yes

Anaconda-Clean creates a backup of all files and directories that might be removed, such as .bash_profile, in a folder named .anaconda_backupin your home directory. Also note that Anaconda-Clean leaves your data files in the AnacondaProjects directory untouched. After using Anaconda-Clean, follow the instructions above in Option A to uninstall Anaconda. Removing Anaconda path from .bash_profile

Anaconda-Clean在您的主目录中.bash_profile命名的文件夹.anaconda_backup中创建可能被删除的所有文件和目录的备份。另请注意,Anaconda-Clean 不会更改 AnacondaProjects 目录中的数据文件。使用 Anaconda-Clean 后,请按照上述选项 A 中的说明卸载 Anaconda。删除 Anaconda 路径.bash_profile

If you use Linux or macOS, you may also wish to check the .bash_profilefile in your home directory for a line such as:

如果您使用 Linux 或 macOS,您可能还希望.bash_profile在您的主目录中检查文件中的一行,例如:

export PATH="/Users/jsmith/anaconda3/bin:$PATH"

NOTE: Replace /Users/jsmith/anaconda3/with your actual path.

注意:替换/Users/jsmith/anaconda3/为您的实际路径。

This line adds the Anaconda path to the PATH environment variable. It may refer to either Anaconda or Miniconda. After uninstalling Anaconda, you may delete this line and save the file.

此行将 Anaconda 路径添加到 PATH 环境变量。它可以指 Anaconda 或 Miniconda。卸载 Anaconda 后,您可以删除此行并保存文件。

by official uninstalling way

通过官方卸载方式

回答by Fiddy Bux

I simply:

我简单地:

rm -rf ~/anaconda3

...this removed conda also.

...这也删除了 conda。

Then:

然后:

mousepad ~/.bashrc

...and removed the path line added at the very bottom (clearly identified by Anaconda as 'added by Anaconda'.

...并删除了添加在最底部的路径线(Anaconda 清楚地将其标识为“由 Anaconda 添加”。

Worth noting that anaconda3 created a backup of my .bashrcfile before modification, and named it as:

值得注意的是anaconda3在修改之前创建了我的.bashrc文件的备份,并将其命名为:

./bashrc-anaconda3.bak

...so I could always have just renamed this and deleted my modified .bashrc

...所以我总是可以重命名它并删除我修改过的 .bashrc

回答by HISI

To uninstall anaconda you have to:

要卸载 anaconda,您必须:

1) Remove the entire anaconda install directory with:

1)删除整个anaconda安装目录:

rm -rf ~/anaconda2

rm -rf ~/anaconda2

2) And (OPTIONAL):

2)和(可选):

->Edit ~/.bash_profile to remove the anaconda directory from your PATH environment variable.

-> 编辑 ~/.bash_profile 以从 PATH 环境变量中删除 anaconda 目录。

->Remove the following hidden file and folders that may have been created in the home directory:

->删除以下可能在主目录中创建的隐藏文件和文件夹:

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

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

source

来源

回答by bruce

rm -rf ~/anaconda3

nano ~/.bashrc
  • Ctrl+Wto search for "Anaconda"
  • Delete or comment out the following lines:

    /home/sammuel/.bashrc
    # added by Anaconda3 4.2.0 installer
    export PATH="/home/sammuel/anaconda3/bin:$PATH"
    
  • Ctrl+W搜索“蟒蛇”
  • 删除或注释掉以下几行:

    /home/sammuel/.bashrc
    # added by Anaconda3 4.2.0 installer
    export PATH="/home/sammuel/anaconda3/bin:$PATH"
    

When you're done editing the file, type Ctrl+Xto exit and yto save changes.

完成文件编辑后,键入Ctrl+X退出并y保存更改。

Anaconda is now removed from your server.

Anaconda 现在已从您的服务器中删除。