Anaconda安装和配置

Linux安装Anaconda3

下载Anaconda3https://www.anaconda.com/download/success
安装bash Anaconda3-xxx-Linux-x86_64.sh
全部选择yes,安装完成重启终端

Linux安装Miniconda3

下载miniconda
https://repo.anaconda.com/miniconda/
x86_64下载:https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
ARM下载:https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh

安装miniconda
执行下载的sh文件,例如:
sh Miniconda3-latest-Linux-x86_64.sh
全部选yes,可以自定义路径
重启终端
设置默认不启动:conda config --set auto_activate_base false

配置conda镜像

vim ~/.condarc加入如下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
auto_activate_base: false
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
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
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

conda常用命令

查看conda版本:conda -V
查看已有的虚拟环境:conda env list
创建虚拟环境:conda create -n env_name python=x.x
删除虚拟环境:conda remove -n env_name --all
激活虚拟环境:conda activate env_name
关闭虚拟环境:conda deactivate