安装GPU版pytorch
conda换源
conda config --remove-key channels
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 --set show_channel_urls yes
创建虚拟环境
conda create -n pytorch python==3.7.3
conda activate pytorch
下载安装pytorch
下载安装命令在官网:https://pytorch.org/get-started/locally/
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
测试安装是否成功
import torch
print(torch.cuda.is_available())
如果输出true即为成功