Python Anaconda-如何安全卸载

问题:Python Anaconda-如何安全卸载

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

当前,当我运行时,which python我会得到以下路径:

/Users/username/anaconda/bin/python

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 ~/anaconda directory? Any other changes required?

Currently when I run which python I get this path:

/Users/username/anaconda/bin/python


回答 0

文档

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

进一步说明:

  • Python3安装可能使用~/anaconda3dir而不是~/anaconda
  • 您可能还有一个~/.anaconda隐藏目录,可以将其删除。
  • 根据您的安装方式,可能会在PATH您的runco​​m文件之一而不是您的Shell配置文件中对其进行修改。因此,例如,如果您使用的是bash,请确保检查您~/.bashrc是否在中没有找到PATH修改过的内容~/.bash_profile

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_profile and remove the anaconda directory from your PATH environment variable, and remove the hidden .condarc file and .conda and .continuum directories which may have been created in the home directory with rm -rf ~/.condarc ~/.conda ~/.continuum.

Further notes:

  • Python3 installs may use a ~/anaconda3 dir instead of ~/anaconda.
  • You might also have a ~/.anaconda hidden directory that may be removed.
  • Depending on how you installed, it is possible that the PATH is 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 ~/.bashrc if you don’t find the PATH modified in ~/.bash_profile.

回答 1

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

The anaconda installer adds a line in your ~/.bash_profile script that prepends the anaconda bin directory to your $PATH environment 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.


回答 2

可从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)

请参阅:https//docs.anaconda.com/anaconda/install/uninstall以获得更多详细信息。

Packageanaconda clean“, available from Anaconda platform, should uninstall safely.

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/uninstall for more details.


回答 3

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

看起来像这样

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

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

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

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 PATH variable which points to anaconda/bin directory in the ~/.bashrc file.

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 ~/.bashrc file executing source ~/.bashrc

Now, verify the changes executing which python in the new terminal.


回答 4

rm -rf ~/anaconda

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

rm -rf ~/anaconda

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


回答 5

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

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

编辑文件.bashrc

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

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

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

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

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.

Go to your home directory. Just a cd command will do.

Edit the file .bashrc.

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

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

#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.


回答 6

卸载Anaconda

要卸载Anaconda,您可以简单地删除该程序。这将留下一些文件,对于大多数用户来说就足够了。请参阅选项A。

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

选项A。

使用简单删除来卸载Anaconda:

macOS –打开Terminal.app或iTerm2终端应用程序,然后通过输入删除整个Anaconda目录,该目录的名称为anaconda2或anaconda3 rm -rf ~/anaconda3

选项B。

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

注意:必须先运行Anaconda-Clean,然后才能将其卸下。

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

conda install anaconda-clean

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

在删除每个与Anaconda相关的文件和目录之前,先确认确认,然后删除每个文件和目录:

anaconda-clean

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

anaconda-clean --yes

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

如果您使用Linux或macOS,则还可能希望检查.bash_profile您的主目录中的文件是否存在以下行:

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

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

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

通过官方卸载方式

Uninstalling 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.

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.

Option A.

Use simple remove to uninstall 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.

Option B.

Full uninstall using Anaconda-Clean and simple remove.

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

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

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-clean

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

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_backup in 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

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

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

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

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.

by official uninstalling way


回答 7

rm -rf ~/anaconda3

nano ~/.bashrc
  • Ctrl+ W搜索“ Anaconda”
  • 删除或注释掉以下几行:

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

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

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

rm -rf ~/anaconda3

nano ~/.bashrc
  • Ctrl+W to 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"
    

When you’re done editing the file, type Ctrl+X to exit and y to save changes.

Anaconda is now removed from your server.


回答 8

如果您有多个版本的anaconda,

rm -rf〜/ anaconda2 [对于版本2]

rm -rf〜/ anaconda3 [对于版本3]

在文本编辑器中打开.bashrc文件

vim .bashrc

从您的PATH中删除anaconda目录。

导出PATH =“ / home / {username} / anaconda2 / bin:$ PATH” [对于版本2]

导出PATH =“ / home / {username} / anaconda3 / bin:$ PATH” [对于版本3]

In case you have multiple version of anaconda,

rm -rf ~/anaconda2 [for version 2]

rm -rf ~/anaconda3 [for version 3]

Open .bashrc file in a text editor

vim .bashrc

remove anaconda directory from your PATH.

export PATH=”/home/{username}/anaconda2/bin:$PATH” [for version 2]

export PATH=”/home/{username}/anaconda3/bin:$PATH” [for version 3]


回答 9

我只是:

rm -rf ~/anaconda3

…这也删除了conda。

然后:

mousepad ~/.bashrc

…并删除了最底部添加的路径线(Anaconda明确标识为“ Anaconda添加”)。

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

./bashrc-anaconda3.bak

…所以我总是可以将其重命名并删除修改后的.bashrc

I simply:

rm -rf ~/anaconda3

…this removed conda also.

Then:

mousepad ~/.bashrc

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

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

./bashrc-anaconda3.bak

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


回答 10

要卸载anaconda,您必须:

1)使用以下命令删除整个anaconda安装目录:

rm -rf ~/anaconda2

2)和(可选):

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

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

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

资源

To uninstall anaconda you have to:

1) Remove the entire anaconda install directory with:

rm -rf ~/anaconda2

2) And (OPTIONAL):

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

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

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

source


回答 11

要从系统中完全卸载Anaconda,请执行以下操作:

  1. 开放终端
  2. rm -rf ~/miniconda
  3. rm -rf ~/.condarc ~/.conda ~/.continuum

To uninstall Anaconda Fully from your System :

  1. Open Terminal
  2. rm -rf ~/miniconda
  3. rm -rf ~/.condarc ~/.conda ~/.continuum

回答 12

rm -rf ~/anaconda3

够了

rm -rf ~/anaconda3

It was enough


回答 13

我一直尝试遵循开发人员的建议,因为现在通常是他们会如何影响您的系统。从理论上讲,这应该是最安全的方法:


从Anaconda Prompt(Linux或macOS上的终端)安装Anaconda-Clean软件包:

conda install anaconda-clean

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

在删除每个与Anaconda相关的文件和目录之前,先确认确认,然后删除每个文件和目录:

anaconda-clean

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

anaconda-clean --yes

Anaconda-Clean创建所有可能在主目录中名为.anaconda_backup的文件夹中删除的文件和目录的备份。还要注意,Anaconda-Clean不会改变您在AnacondaProjects目录中的数据文件。

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

I always try to follow the developers advice, since they are usually the ones that now how it would affect your system. Theoretically this should be the safest way:

Install the Anaconda-Clean package from Anaconda Prompt (terminal on Linux or macOS):

conda install anaconda-clean

In the same window, run one of these commands:

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

anaconda-clean

  1. Remove all Anaconda-related files and directories without being prompted to delete each one:

anaconda-clean --yes

Anaconda-Clean creates a backup of all files and directories that might be removed in a folder named .anaconda_backup in your home directory. Also note that Anaconda-Clean leaves your data files in the AnacondaProjects directory untouched.

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


回答 14

就我而言,Anaconda3尚未安装在主目录中。而是将其安装在root用户中。因此,我必须执行以下操作才能将其卸载:

sudo rm -rf /anaconda3/bin/python

In my case Anaconda3 was not installed in home directory. Instead, it was installed in root. Therefore, I had to do the following to get it uninstalled:

sudo rm -rf /anaconda3/bin/python

回答 15

对于窗户

  • 使用以下命令安装anaconda-clean模块

    conda install anaconda-clean

    然后,运行以下命令逐步删除文件:

    anaconda-clean

    或者,只需运行以下命令将其全部删除-

    anaconda-clean --yes
  • 在此打开控制面板>程序>卸载程序之后,在这里卸载发布者是Anaconda的python。

  • 现在,您可以从PATH变量中删除anaconda / scripts和/ anaconda /。

希望能帮助到你。

For windows

  • Install anaconda-clean module using

    conda install anaconda-clean
    

    then, run the following command to delete files step by step:

    anaconda-clean
    

    Or, just run following command to delete them all-

    anaconda-clean --yes
    
  • After this Open Control Panel> Programs> Uninstall Program, here uninstall that python for which publisher is Anaconda.

  • Now, you can remove anaconda/scripts and /anaconda/ from PATH variable.

Hope, it helps.