首先查看自己的 cuda 版本
在 NVIDIA 控制面板,左下角系统信息,组件,可以看到 NVCUDA.DLL 的版本号
然后在 这里 找到对应版本
然后在命令中加入 --default-timeout=2000
,下载过程中会有一段时间比较慢
pip install --default-timeout=2000 torch===1.7.1+cu110 torchvision===0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
然后下载完,测试一下
import torch
x = torch.rand(5, 3)
print(x)
import torch
torch.cuda.is_available()
如果返回 True 就好啦😄