当前位置:网站首页>Unable to import torchvision. IO. Read_image
Unable to import torchvision. IO. Read_image
2022-08-05 06:48:00 【ProfSnail】
Running the official websitepytorch案例的时候,发现无法从torchvision.io中导入read_image.
ImportError: cannot import name 'read_image' from 'torchvision.io'
查看torchvision的版本发现是0.6backward version.
In [1]: import torchvision as tv
In [2]: tv.__version__
Out[2]: '0.6.0'
升级torchvision版本即可,使用pip进行升级.
pip install --upgrade torchvision
However, it is found that there is a problem of abnormal access permissions.
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问.: 'c:\\users\\zhang\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\~orch\\lib\\asmjit.dll'
Consider using the `--user` option or check the permissions.
Added when upgrading–user选项即可.
pip install --user --upgrade torchvison
检查版本号,发现升级成功.
In [1]: import torchvision as tv
In [2]: tv.__version__
Out[2]: '0.10.0+cpu'
In [3]: tv.io.read_image
Out[3]: <function torchvision.io.image.read_image(path: str, mode: torchvision.io.image.ImageReadMode = <ImageReadMode.UNCHANGED: 0>) -> torch.Tensor>
不过这样还是不行,因为升级到了cpu版本,cuda不能调用了.Simply uninstalledtorch,重新安装了一遍.
pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
这下就没问题了.
In [1]: import torch
In [2]: torch.__version__
Out[2]: '1.9.0+cu111'
In [3]: torch.cuda.is_available()
Out[3]: True
In [4]: import torchvision as tv
In [5]: tv.__version__
Out[5]: '0.10.0+cu111'
边栏推荐
- txt文件英语单词词频统计
- 淘宝客APP带自营商城本地生活CPS外卖优惠电影票话费更新渠道跟单生活特权V3
- Next-Generation Parsing Technology - Cloud Parsing
- VSCode编写OpenCV
- 云计算基础-学习笔记
- NB-IOT智能云家具项目系列实站
- 深入分析若依数据权限@datascope (注解+AOP+动态sql拼接) 【循序渐进,附分析过程】
- 花花省V5淘宝客APP源码无加密社交电商自营商城系统带抖音接口
- DevOps流程demo(实操记录)
- GetEnumerator method and MoveNext and Reset methods in Unity
猜你喜欢
![In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]](/img/b5/03f55bb9058c08a48eae368233376c.png)
In-depth analysis if according to data authority @datascope (annotation + AOP + dynamic sql splicing) [step by step, with analysis process]

花花省V5淘宝客APP源码无加密社交电商自营商城系统带抖音接口

NB-IOT智能云家具项目系列实站

Teach you simple steps to achieve industrial raspberries pie properly installed RS232 USB drive

Quick Start to Drools Rule Engine (1)

numpy.random usage documentation

ALC experiment

数组&的运算

人人AI(吴恩达系列)

Cocos Creator Mini Game Case "Stick Soldier"
随机推荐
多用户商城多商户B2B2C拼团砍价秒杀支持小程序H5+APP全开源
DisabledDate date picker datePicker
七种让盒子水平垂直居中的方法
product learning materials
Get the network input dimensions of the pretrained model
VLAN is introduced with the experiment
LaTeX 图片加标题 文本分栏自动换行
Writing OpenCV in VSCode
Alibaba Cloud Video on Demand
LeetCode刷题记录(2)
盒子模型小练习
System basics - study notes (some command records)
单片机原理与应用复习
NB-IOT智能云家具项目系列实站
云计算基础-学习笔记
Shadowless Cloud Desktop
Linux中安装Redis教程
NAT experiment
花花省V5淘宝客APP源码无加密社交电商自营商城系统带抖音接口
多线程之传递参数