1. 程式人生 > >anaconda 環境管理

anaconda 環境管理

最近常用anaconda來管理環境,一些比較常用的如下

1.使用命令列安裝(版本可更改)

1)download the .sh file first: wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh
2)bash file_name

2.新建一個乾淨的conda環境

conda create env --name myenv_name

用現有的yml檔案建立

conda env create -f environment.yml

3.匯出當前環境到某個yml檔案

conda env export > environment_demo.yml

4.解除安裝anaconda

rm -rf ~/anaconda
rm -rf ~/.anaconda/navigator
rm -rf ~/.condarc ~/.conda ~/.continuum
nano ~/.bash_profile # remove the anaconda directory from your PATH env var
remove the shortcut from the applications folder

5.一個問題的解決辦法
cannot find conda command after instaling

export PATH=~/anaconda3/bin:$PATH(等號左右不要加空格)

6.刪除一個conda環境

conda remove --name myenv --all

7.使用conda安裝指定版本的包,例如安裝0.19.2版本的sklearn

conda install scikit-learn=0.19.2

8.使用conda解除安裝已經安裝的包

conda uninstall pkg_name

9.檢視所有已經安裝的包

conda list