一、创建conda新环境
$ conda create -n XXX python=XXX
二、conda更新
$ conda update -n base conda
三、conda换源
由于从pytorch官网下载速度较慢,换成清华源。
# 更换conda源
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
$ conda config --set show_channel_urls yes
四、安装
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2
安装前需要查看是否有GPU,显卡驱动等是否安装成功!
大功告成!