1.下载Anaconda 安装包:https://www.anaconda.com/products/individual#Downloads
2.选择对应Linux的安装包下载
3.安装Anconda
sudo bash Anaconda3-2020.11-Linux-x86_64.sh
安装路径默认为/root/anaconda3,我的设置为/anaconda3
4.安装好后,它自动配置环境变量到root,而不是当前用户,打开root的.bashrc
sudo gedit /root/.bashrc
可以看到最后添加了:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
. "/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
5.将这段环境变量复制到,当前用户的.bashrc
sudo gedit ~/.bashrc
重新加载环境变量
source ~/.bashrc
6.验证是否安装成功
conda --version