一、环境
1、Anaconda5.3.1
C:Userszxr20>conda --version conda 4.9.2
2、cuda10.1
C:Userszxr20>nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2019 NVIDIA Corporation Built on Fri_Feb__8_19:08:26_Pacific_Standard_Time_2019 Cuda compilation tools, release 10.1, V10.1.105
3、python3.7(这个不用安装)
4、显卡驱动:
https://developer.nvidia.com/cuda/wsl/download
二、pytorch安装
1、用梯子
conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch
2、验证
4、看pytorch是否可用,GPU是否可用
解释器要用Anaconda的:E:ProgramDataAnaconda3python.exe
import torch print(torch.__version__) print("gpu:", torch.cuda.is_available())
D:Userszxr20Anaconda3python.exe D:/pytorch/Lesson_2/main.py 1.7.0 gpu: True