Python
Anaconda

さよならアナコンダ(How to uninstall Anaconda)

環境

Python 3.6.5 |Anaconda, Inc.

問題

Anacondaいらなくなったので消したい。

手順

anaconda-cleanをインストール

$ conda install anaconda-clean
Solving environment: done # 時間かかる

## Package Plan ##

  environment location: /root/anaconda3

  added / updated specs: 
    - anaconda-clean


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    anaconda-clean-1.1.0       |           py36_0           5 KB
    conda-4.5.8                |           py36_0         1.0 MB
    ------------------------------------------------------------
                                           Total:         1.0 MB

The following NEW packages will be INSTALLED:

    anaconda-clean: 1.1.0-py36_0

The following packages will be UPDATED:

    conda:          4.5.4-py36_0 --> 4.5.8-py36_0

Proceed ([y]/n)? y # yを入力
Downloading and Extracting Packages
anaconda-clean-1.1.0 |    5 KB | ################################ | 100% 
conda-4.5.8          |  1.0 MB | ################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

anaconda-cleanを実行

$ anaconda-clean
Delete .conda? (y/n): y # yを入力
Backup directory: /root/.anaconda_backup/2018-07-13T095546
Delete .ipython? (y/n): y # yを入力
Delete .jupyter? (y/n): y # yを入力
Delete .theano? (y/n): y # yを入力

$ python --version
Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 18:10:19) 

Anacondaのディレクトリを削除

$ cd PATH_TO_ANACONDA # あなたのアナコンダパス
$ rm -rf anaconda3 # 時間かかる3Gくらいある?
$ python
-bash: /root/anaconda3/bin/python: そのようなファイルやディレクトリはありません

Anacondaのパスを削除

$ vim ~/.bashrc #.bash_profileかもしれない
# added by Anaconda3 installer
export PATH="/root/anaconda3/bin:$PATH" # <-この行を削除

設定再読み込み

$ source ~/.bash_rc
$ python --version
Python 2.7.5 (default, Nov  6 2016, 00:28:07)