当前位置:网站首页>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
边栏推荐
- 滑窗法切分数据
- CentOS7 - yum install mysql
- Indoor real-time laser SLAM control method based on biological excitation neural network
- 关于MySQL主从复制的数据同步延迟问题
- 分布式监视 Zabbix 和 Prometheus 到底怎么选?千万别用错了!
- Edge Cloud Explained in Simple Depth | 4. Lifecycle Management
- 攻防演练丨赛宁红方管控平台走进广东三地 助力数字政府网络安全建设
- Golang - gin - pprof - use and safety
- IDEA的database使用教程(使用mysql数据库)
- AMBA APB学习记录(AMBA 3/4)
猜你喜欢
networkx绘制度分布
C#使用ComboBox控件
IDEA版Postman插件Restful Fast Request,细节到位,功能好用
报错IDEA Terminated with exit code 1
Error IDEA Terminated with exit code 1
NameNode (NN) 和SecondaryNameNode (2NN)工作机制
How does the SAP ABAP OData service support the $filter (filter) operation trial version
C#控件CheckBox的使用
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
手撕Verilog PWM呼吸灯
随机推荐
战略进攻能力的重要性,要远远高于战略防守能力
基于模糊预测与扩展卡尔曼滤波的野值剔除方法
深入浅出边缘云 | 4. 生命周期管理
ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
抓住金三银四的尾巴,解锁程序员面试《刷题神器》
CentOS7 安装MySQL 图文详细教程
C#控件StatusStrip使用
分布式监视 Zabbix 和 Prometheus 到底怎么选?千万别用错了!
计算机复试面试问题(计算机面试常见问题)
ASM module in SAP Ecommerce Cloud Spartacus UI and Accelerator UI
操作符详解
PyQt5 rapid development and actual combat 9.7 Automated testing of UI layer
The importance of strategic offensive capability is much higher than strategic defensive capability
JSP中如何借助response对象实现页面跳转呢?
TensorRT安装及使用教程「建议收藏」
Talk about the message display mechanism on the SAP product UI
C#控件 ToolStripProgressBar 用法
How does the SAP ABAP OData service support the $filter (filter) operation trial version
Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
CWE4.8 -- 2022年危害最大的25种软件安全问题