xuzhengfu / pilot

进入编程世界的第一课
1 stars 0 forks source link

卸载 anaconda #3

Open xuzhengfu opened 4 years ago

xuzhengfu commented 4 years ago

1. 搜索 anaconda 的卸载方法

Google ”uninstall anaconda“,阅读文档。采用 Option B. Full uninstall using Anaconda-Clean and simple remove.

2. 具体操作步骤

执行以下命令:

conda install anaconda-clean

结果如下:

Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: /Users/xuzhengfu/anaconda3

  added / updated specs:
    - anaconda-clean

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    anaconda-clean-1.1.0       |           py37_1           7 KB
    conda-4.8.1                |           py37_0         3.0 MB
    conda-package-handling-1.6.0|   py37h1de35cc_0         1.4 MB
    ------------------------------------------------------------
                                           Total:         4.5 MB

The following NEW packages will be INSTALLED:

  anaconda-clean     pkgs/main/osx-64::anaconda-clean-1.1.0-py37_1
  conda-package-han~ pkgs/main/osx-64::conda-package-handling-1.6.0-py37h1de35cc_0

The following packages will be UPDATED:

  conda                     conda-forge::conda-4.6.8-py37_0 --> pkgs/main::conda-4.8.1-py37_0

Proceed ([y]/n)? y

Downloading and Extracting Packages
anaconda-clean-1.1.0 | 7 KB      | ############################################ | 100% 
conda-4.8.1          | 3.0 MB    | ############################################ | 100% 
conda-package-handli | 1.4 MB    | ############################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) 

执行以下命令:

anaconda-clean

结果如下:

Delete .anaconda? (y/n): y
Backup directory: /Users/xuzhengfu/.anaconda_backup/2020-02-02T155756
Delete .conda? (y/n): y
Delete .condarc? (y/n): y
Delete .ipynb_checkpoints? (y/n): y
Delete .ipython? (y/n): y
Delete .jupyter? (y/n): y
Delete .matplotlib? (y/n): y
(base) 

执行以下命令:

rm -rf ~/anaconda3

结果如下:

(base) 

3. 清除备份文件(存有疑问)

原因在于:

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.

可是,在 spotlight 中没找到该备份,在 Macintosh HD 里也没找到。 猜想:因为先执行了 option B,后执行了 option A,所以那些备份已经被删除了。

4. Removing Anaconda path from .bash_profile

打开 .bash_profile,执行以下命令:

touch ~/.bash_profile
open ~/.bash_profile

将以下内容从 .bash_profile 中删除,而后保存。

# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/xuzhengfu/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/xuzhengfu/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/xuzhengfu/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/xuzhengfu/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

Reference

https://docs.anaconda.com/anaconda/install/uninstall/ https://stackoverflow.com/questions/30461201/how-do-i-edit-path-bash-profile-on-osx

Logging

2020-02-02 17:14:20 initialize