一·Anaconda下载
进入anaconda官方网站下载个人免费版本,网站链接,点击download,选择Linux平台的安装包
二·Anaconda安装
1.执行如下指令,安装anaconda
# 进入当保存文件的目录,执行此指令, 后期由于版本更新,可能会与此文件命名有所不同
bash Anaconda3-2020.11-Linux-x86_64.sh
2.按照安装提示,键入回车,
Please, press ENTER to continue
>>> ENTER
3.安装此版本时,会强制用户看完整个协议,直接一路回车就行,直到看到确认信息
# 输入yes,表示同意安装协议
Do you accept the license terms? [yes|no][no]
>>> yes
4.确认安装路径(可修改,也可以使用自定义)
# 使用默认路径,直接键入回车,使用自定义路径,直接输入安装路径
# 此处使用 /opt/anaconda3作为安装路径
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] >>> /opt/anaconda3
注:安装位置可以在执行安装脚本的时候直接指定,可以这样修改执行内容:
bash Anaconda3-2020.11-Linux-x86_64.sh -p /opt/anaconda3
这样可跳过软件安装路径确认阶段,直接安装到指定目录下。
5.环境变量初始化
# 此处询问是否初始化conda的环境,直接输入yes
Do you wish the installer to initialize Anaconda3
by running conda init?
[yes|no][no] >>> yes
6.初始化时,anaconda将配置写入了~/.bashrc 文件,直接执行
source ~/.bashrc
后即可正常使用了。
7.配置多用户使用
将anaconda初始化时,写入到 ~/.bashrc 文件中的内容复制到 /etc/bashrc 文件中,内容如下(此处仅为示例,请复制本机对应文件中的相应内容)
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
再执行 source /etc/bashrc 指令即可。
三·配置镜像源
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud