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


边栏推荐
- The function of SQL GROUP BY dependence
- Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"
- C#使用NumericUpDown控件
- docker部署完mysql无法连接
- 365-day challenge LeetCode1000 questions - Day 044 Maximum element in the layer and level traversal
- Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
- C#控件StatusStrip使用
- sqlalchemy 判断一个array 类型的字段是否和一个array有至少一个一致的数据
- C# 中的Async 和 Await 的用法详解
- 滑窗法切分数据
猜你喜欢
随机推荐
Indoor real-time laser SLAM control method based on biological excitation neural network
IDEA版Postman插件Restful Fast Request,细节到位,功能好用
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
[RPI]树莓派监控温度及报警关机保护「建议收藏」
C# 中的Async 和 Await 的用法详解
EasyMock日记1[通俗易懂]
How IDEA runs web programs
SAP 电商云 Spartacus SSR Optimization Engine 几处 timeout 的执行顺序
selenium被反爬了怎么办?
【牛客刷题-SQL大厂面试真题】NO3.电商场景(某东商城)
ECCV2022: Recursion on Transformer without adding parameters and less computation!
基本语法(二)
抓住金三银四的尾巴,解锁程序员面试《刷题神器》
WPF中报错:“未将对象引用设置到对象的实例。”
centos7安装mysql5.7步骤(图解版)
基本语法(一)
系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】
PyQt5 rapid development and actual combat 9.7 Automated testing of UI layer
IDEA的database使用教程(使用mysql数据库)
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
![[CPU Design Practice] Simple Pipeline CPU Design](/img/83/e1dfedfe2b2cfe83a34f86e252caa7.jpg)








