当前位置:网站首页>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


边栏推荐
- How does the SAP ABAP OData service support the $filter (filter) operation trial version
- 【CPU设计实战】简单流水线CPU设计
- Fully Dynamically Constrained Robot Efficient Time-Optimal Trajectory Planning
- 网络协议及相关技术详解
- The function of SQL GROUP BY dependence
- Centos7 install mysql5.7 steps (graphical version)
- Talk about the message display mechanism on the SAP product UI
- Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"
- 电商rpa是什么意思?跟电商rpi是一个意思吗?
- PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
猜你喜欢
随机推荐
WPF中TabControl动态获取当前选中的TabItem
golang-gin - graceful restart
IDEA的database使用教程(使用mysql数据库)
golang中使用泛型
CentOS7 - yum install mysql
使用openssl命令生成证书和对应的私钥,私钥签名,公钥验签
集群的安全模式
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
通过斐波那契数再谈函数递归2.0
sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
Fully Dynamically Constrained Robot Efficient Time-Optimal Trajectory Planning
计算机复试面试问题(计算机面试常见问题)
AMBA APB学习记录(AMBA 2.0)
Centos7 install mysql5.7
网络层重点协议——IP协议
0x80070570 The file or directory is damaged and cannot be deleted (how to delete 0x80070091)
抓住金三银四的尾巴,解锁程序员面试《刷题神器》
集群中增加数据节点与退役数据节点
Use IN List Population in Your JDBC Application to Avoid Cursor Cache Contention Issues
NPM 使用介绍








