当前位置:网站首页>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'
边栏推荐
- Cloud Computing Basics - Study Notes
- txt文件英语单词词频统计
- May I ask how to read the binlog of the two tables of hologres through flink sql, and then how to join?
- 盒子模型大详解
- 【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)
- NACOS配置中心设置配置文件
- Mina disconnects and reconnects
- NAT experiment
- Collision, character controller, Cloth components (cloth), joints in the Unity physics engine
- el-progress implements different colors of the progress bar
猜你喜欢
Tips for formatting code indentation
After docker is deployed, mysql cannot connect
HelloWorld
盒子模型大详解
ev加密视频转换成MP4格式,亲测可用
Error correction notes for the book Image Processing, Analysis and Machine Vision
Teach you simple steps to achieve industrial raspberries pie properly installed RS232 USB drive
uniapp打包次数限制怎么办?只需两步就能解决
多线程之传递参数
NACOS Configuration Center Settings Profile
随机推荐
May I ask how to read the binlog of the two tables of hologres through flink sql, and then how to join?
系统基础-学习笔记(一些命令记录)
Next-Generation Parsing Technology - Cloud Parsing
LaTeX 图片加标题 文本分栏自动换行
多行文本省略
浏览器兼容汇总
Passing parameters in multiple threads
The size of the screen adaptation
【FAQ】What is Canon CCAPI
Detailed explanation of the construction process of Nacos cluster
NAT experiment
Complete mysql offline installation in 5 minutes
记录vue-页面缓存问题
product learning materials
无法导入torchvision.io.read_image
Chengyun Technology was invited to attend the 2022 Alibaba Cloud Partner Conference and won the "Gathering Strength and Going Far" Award
Transformer interprets and predicts instance records in detail
Mina's long and short connections
The use of three parameters of ref, out, and Params in Unity3D
input detailed file upload