安装

  1. 下载
  2. 默认安装
  3. 添加到 PATH
    添加 anaconda 安装目录到 PATH,保证 python 可以在 CMD 等环境下调用
    添加 anaconda\Scripts 到 PATH,保证 conda 可以正常调用
    添加 anaconda\Library\bin 到 PATH

配置

配置 conda

  1. 更换至清华源
    通过修改用户目录下的 .condarc 文件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
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

# 如需修改环境路径和缓存路径
envs_dirs:
- xxxx
- xxxx
pkgs_dirs:
- xxxx
- xxxx

  Linux 环境下可以利用conda config --set show_channel_urls yes生成.condarc文件,再vim ~/.condarc写入

  Ps 更新 pip 源到清华源pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple,需要 pip>=10.0.0,可以通过临时使用清华源更新 pippip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

  1. 环境
1
2
3
4
# 新建
conda creat -n [env_name] [list_of_packages]
# 激活/切换
conda activate [env_name]
  1. 更新 anaconda\conda
1
2
conda update anaconda
conda update conda
  1. 更新所有包
1
conda upgrade --all

使用 conda 安装 cuda 和 cudnn

  1. 安装 cuda

    1
    conda install -n env_name cudatoolkit=<版本号>
  2. 安装 cudnn

    1
    conda install -n env_name cudnn=<版本号>

更多 conda 命令见文档