Windows上搭建Pytorch平台

Windows上搭建GPU版本的Pytorch

电脑配置详情:RTX3060, cuda 11.4, windows11
在这里插入图片描述

总结:具体步骤如下:

安装anaconda——> torch官网查看对应版本——>安装cuda——>安装cudnn
——>创建环境——>安装GPU版本的pytorch——>验证搭建完成

附加设置:

1.安装anaconda

官网下载:https://repo.anaconda.com/archive/
下载版本为 :(python 版本3.7.3)在这里插入图片描述具体安装过程参考此处

2.查看torch版本

进入该网站可查看到适配的cuda版本为11.3,且能获得安装指令Run this Command:
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
(安装的pytorch版本为1.11.0)

在这里插入图片描述

3.安装cuda

安装详细过程参考此处
cuda toolkit下载地址: https://developer.nvidia.com/cuda-toolkit-archive

选择:在这里插入图片描述
点击后按图选取:在这里插入图片描述

4.安装cudnn

下载链接:https://developer.nvidia.com/rdp/cudnn-archive

cuda和cudnn的安装过程参考此博客,下载版本选择如下图在这里插入图片描述

5.创建环境,搭建GPU版本Pytorch

首先,需要使用清华镜像源,参考该博客

步骤1:打开Anaconda prompt,依次输入下面几行代码

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 config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

步骤2:创建pytorch环境,输入下面代码,使用的python版本是3.7.3(其他版本的python应该也可以):

conda create -n pytorch_env_name python=3.7.3`

步骤3:进入环境

activate pytorch_env_name

步骤4:输入torch的安装指令Run this Command(使用清华源后要删去 -c pytorch)

conda install pytorch torchvision torchaudio cudatoolkit=11.3

步骤5:搭建完成!!!

6.验证搭建完成

此处查看,在pycharm中如何使用搭建的pytorch环境。
输入以下代码验证是否搭建成功:

import torch
print("torch {}".format(torch.__version__))
print(torch.cuda.is_available())
print(torch.version.cuda)

成功将显示
在这里插入图片描述

参考:

使用清华镜像安装pytorch教程和出现的问题以及解决方法

Pytorch入门+实战系列一:Windows下的Pytorch环境手把手搭建

cuda11.3安装+cudnn11.3安装+torch1.10.2安装+torchvision0.11.3下载

【CUDA】cuda安装 (windows版)

Anaconda+pyTorch+VScode安装配置说明

Python&aconda系列:GPU深度学习环境搭建:Win11+CUDA 11.7+Pytorch1.12.1+Anaconda以及对应版本

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值