cuda、torch、torchvision对应版本以及安装

查找torch与torchvision对应版本

github链接:https://github.com/pytorch/vision#installation
在这里插入图片描述

在线下载或者离线下载

1、在线下载
pytorch官网选择相应的历史版本,使用conda或者pip安装,使用官网的镜像下载很慢,建议使用其他的镜像源,这里我使用的是阿里的镜像速度还不错。
在这里插入图片描述

pip install torch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 -i https://mirrors.aliyun.com/pypi/simple/

2、离线下载
torch网站中选择cuda、torch、torchivsion、python的对应版本,想下载cpu版本的开头选cpu,向下载gpu版本的选cu开头的,注意一定要下载对应的版本,要不然会有很多错误!
CUDA11.3目录
在这里插入图片描述
cu102/torch-1.7.1-cp38-cp38-linux_x86_64.whl

  • cu102:表示cuda版本为10.2,
  • torch-1.7.1:表示torch版本为1.7.1
  • cp38:表示适用python版本为3.8
  • linux:表示适用于linux系统
  • x86_64:表示同时兼容32和64位系统

下载完成后激活进入环境,pip install 路径\文件名.whl 安装即可

测试

如果安装成功,在环境中pip list即可查看安装的torch、torchvision、torchaudio版本
在这里插入图片描述
或者可以执行以下命令查看torch的版本

python
import torch
print(torch.__version__)

在这里插入图片描述
使用torch查看cuda、cudnn版本

import torch
print(torch.__version__)
print(torch.version.cuda)
print(torch.backends.cudnn.version())

在这里插入图片描述

  • 54
    点赞
  • 259
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值