首先更换清华源

  • 终端中输入:gedit ~/.condarc
  • 将内容更改为:
channels:
   	  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
   	  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
   	  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
   	  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
   	  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123
   	  - defaults
show_channel_urls: true

安装

  • 如果已经安装虚拟环境,记得先打开虚拟环境。虚拟环境的安装可见:https://blog.csdn.net/JianJuly/article/details/80300473
  • 安装链接
  • 在安装链接中,根据操作系统和CUDA版本选择安装指令,并使用指令进行安装
  • 注意事项:记得一定要把指令最后的 -c pytorch 删除,不然会强制使用默认的源,安装速度特别慢
    在这里插入图片描述

最后

打开 python,输入以下内容测试并查看版本

import torch
import torchvision

print(torch.__version__)
print(torchvision.__version__)

在这里插入图片描述

大功告成

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐