一、安装Anaconda

先在官网下载安装包,然后运行

bash Anaconda3-5.2.0-Linux-x86_64.sh

一路yes

提示信息“Do you wish the installer to initialize Anaconda3in your /home/hsy/.bashrc ? [yes|no]”
输入yes;



提示信息“Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]”,
输入no;



提示信息
Anaconda3 will now be installed into this location:
/home/hsy/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
确认安装位置,Enter!

安装完成

Anaconda默认安装在home目录下,所以只要重装系统时不格式化home那个分区,那么自己创建的conda环境就会得到保留,不会被删掉。




二、配置环境变量

打开配置文件

sudo  gedit ~/.bashrc

在最后添加(路径因人而异):

export PATH="/home/用户名/anaconda3/bin:$PATH"

刷新:

source ~/.bashrc




三、验证

检查 conda : conda -V
检查 python: python -V




四、创建环境

conda  create -n name python=3.7

查看当前存在哪些虚拟环境

conda env list

详细的:https://zhuanlan.zhihu.com/p/94744929




五、卸载Anaconda

删除Anaconda3目录:

rm -rf ~/anaconda3

删除环境变量:

sudo gedit ~/.bashrc

删掉这一行

export PATH="/home/用户名/anaconda3/bin:$PATH"

刷新:

source ~/.bashrc