1、下载Anaconda
版本Anaconda3-5.2.0
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh
2、添加可执行权限
# 添加权限的命令
chmod +x Anaconda3-5.2.0-Linux-x86_64.sh
3、安装
# 安装
./Anaconda3-5.2.0-Linux-x86_64.sh -u
或者 bash Anaconda3-5.2.0-Linux-x86_64.sh -u
# -u:为了后续更改安装目录,如果不添加“-u”,则会出现“ERROR: File or directory already exists: '/usr/local/anaconda3'
# If you want to update an existing installation, use the -u option.”问题
4、同意条款
(1)首先提示查看条款“In order to continue the installation process, please review the license
agreement. Please, press ENTER to continue”,点击Enter;
(2)查看条款后,提示“Do you accept the license terms? [yes|no]”,
输入:yes,进入下一步。
5、修改自定义目录
修改自定义目录之前提示"
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
"
# 修改自定义目录
[/root/anaconda3] >>> /usr/local/anaconda3
6、设置配置路径
“Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /root/.bashrc ?”
输入:yes
7、设置环境变量
1)在"/etc/profile"中的最后一行添加环境变量
# Anaconda3
export PATH=$PATH:/etc/usr/local/anaconda3/bin
# 使Python3生效
source /etc/profile
2)可以不配置环境变量,在/usr/bin下添加软连接
# ln -s 源文件/目录 目标文件/目录
ln -s /usr/local/anaconda3/bin/python3 /usr/bin/python3
8、测试
# 测试,默认是python2,使用python3
python3