当前位置:网站首页>pytorch gpu版本安装最新
pytorch gpu版本安装最新
2022-07-31 13:03:00 【BRYTLEVSON】
pytorch gpu版本安装最新
之前写的一篇时间已久, 正好要安装最新的,今天分享一下
1. 创建虚拟环境
支持下面任一环境:
- 使用conda
- 使用python对应的虚拟环境管理工具等 virtualenv
- 主环境
这步具体步骤跳过
2. 使用conda来实践
1. 环境
- 使用conda来创建名叫pytorch190 python版本为3.9的虚拟环境
conda create -n pytorch190 python=3.9

2. 查看本电脑的gpu
- 设备管理查看显卡版本

- 到英伟达驱动官网查看对应的
驱动官网
我自己的驱动版本
查询结果 我自己的是511.79
到英伟达toolkit网站查看自己版本的compoets版本以及自己的CUDA 版本
知道自己的cuda版本之后,就可以安装gpu版本的torch了
3. 安装torch
- 到pytorch官网
pytorch官网
选择自己cuda对应最新版本的pytorch版本,我选择了最新的1.9.0版本

2. 进入虚拟环境执行安装命令
安装方式1 conda安装
进入虚拟环境
activate pytorch190
安装方式1
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=10.2 -c pytorch
注意
注意 -c pytorch不能少,少了安装的时gpu版本
安装方式2 pip安装
进入虚拟环境
activate pytorch190
安装方式1
pip install torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
注意
这里不能使用清华源,如果时清华源,一定要删除,不然装的时cpu版本的,这里一定要注意。
查看channel
conda config --show
conda config --get channels
# 添加源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
#pytorch
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
# 删除源
conda config --remove channels CHANNEL
总结
以上两种方式安装都是国外下载,好几个G很慢
我解决的办法是,自己到 https://download.pytorch.org/whl/torch_stable.html
pytorch官方库下载
下载对应的版本 然后cmd pip install 手动安装即可
测试安装成功
import torch
torch.cuda.is_available()
True


边栏推荐
- 分布式锁有哪些,怎么实现(分布式锁的三种实现的对比)
- PartImageNet物体部件分割(Semantic Part Segmentation)数据集介绍
- 关于MySQL主从复制的数据同步延迟问题
- FastAPI encapsulates a generic response
- JSP response对象简介说明
- 【CPU设计实战】简单流水线CPU设计
- 【牛客刷题-SQL大厂面试真题】NO3.电商场景(某东商城)
- ECCV2022:在Transformer上进行递归,不增参数,计算量还少!
- Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
- 365天挑战LeetCode1000题——Day 044 最大层内元素和 层次遍历
猜你喜欢

ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法

Invalid bound statement (not found)出现的原因和解决方法

PHP序列化:eval

C#控件 ToolStripProgressBar 用法

Optimization of five data submission methods

C#使用ComboBox控件

log4j2的使用

ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your

PyQt5 rapid development and actual combat 9.7 Automated testing of UI layer

C#控件CheckBox的使用
随机推荐
/run/NetworkManager占用空间过大
FastAPI encapsulates a generic response
0x80070570 The file or directory is damaged and cannot be deleted (how to delete 0x80070091)
关于我放弃考研这件事儿
anaconda虚拟环境安装pytorch gpu版本
PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
Selenium自动化测试之Selenium IDE
C#获得网卡信息 NetworkInterface IPInterfaceProperties
WPF中报错:“未将对象引用设置到对象的实例。”
报错:npm ERR code EPERM
查看Mysql数据库版本
go中select语句
MATLAB | 我也做了一套绘图配色可视化模板
C# 中的Async 和 Await 的用法详解
Invalid bound statement (not found)出现的原因和解决方法
Architecture Camp | Module 8
基于改进YOLOv5的轻量化航空目标检测方法
函数递归1.0
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
Introduction to using NPM