pytorch(1):win10环境下安装pytorch

一、环境

1、Anaconda5.3.1

C:\Users\zxr20>conda --version
conda 4.9.2

2、cuda10.1

C:\Users\zxr20>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:\ProgramData\Anaconda3\python.exe

import torch
print(torch.__version__)
print("gpu:", torch.cuda.is_available())
D:\Users\zxr20\Anaconda3\python.exe D:/pytorch/Lesson_2/main.py
1.7.0
gpu: True

 

posted @ 2020-11-15 17:36  jasonzhangxianrong  阅读(260)  评论(0编辑  收藏  举报