python报错AttributeError: module ‘scipy.misc’ has no attribute 'imresize’和 ‘imread’

报错原因:scipy版本过高

解决方案:降低scipy版本,如下:

pip install scipy==1.2.1

版本是scipy==1.2.1时,如果还报错,那就安装Pillow即可

pip install pillow

如果之后因为scipy版本过低引起异常,那就直接改个接口函数即可,scipy不进行降级了。

官方scipy中提到,imread is deprecated! imread is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use imageio.imread instead.

SciPy1.0.0不赞成使用imread,在1.2中已经弃用,可以使用imageio.imread来代替

引发imresize的是TensorFlow.prepro.imresize高层api,不知道改为什么接口了。但可以参考网上的

安装scikit-image

pip3 install scikit-image

调用resize()

from skimage.transform import resize
my_image = resize(image, output_shape=(64, 64)).reshape((1, 64 * 64 * 3)).T

注意:这里的resize()的参数与较老版本的scipy.misc中的imresize()有所不同,前者的output_shape参数对应后者的size参数。

python报错AttributeError module ‘scipy.misc‘ has no attribute ‘imresize‘和 ‘imread‘相关推荐

  1. 不降低scipy版本解决AttributeError: module ‘scipy.misc‘ has no attribute ‘imresize‘问题

    问题描述 在Tensorflow2.1.0上运行代码出现 AttributeError: module 'scipy.misc' has no attribute 'imresize' 查阅资料大多都 ...

  2. pythont提示AttributeError: module ‘scipy.misc‘ has no attribute ‘imsave‘或‘imread‘

    本人在使用pytorch进行vgg16特征图可视化画图时碰到了以上问题,查询解决方法时很多建议 pip install Pillow 但是我这里输入后显示已经安装,而且还是报错,显然不是这个问题.后来 ...

  3. 解决AttributeError: module ‘scipy.misc‘ has no attribute ‘imread‘问题

    在跑FCN时报错 AttributeError: module 'scipy.misc' has no attribute 'imread'. 查阅网上资料之后发现,大部分解决办法都是说没有安装PIL ...

  4. 解决AttributeError: module ‘scipy.misc‘ has no attribute ‘imread‘报错问题

    运行python程序报错:AttributeError: module 'scipy.misc' has no attribute 'imread' 报错原因1:scipy版本过高 解决方案:降低sc ...

  5. 【Flask】flask-bootstrap报错AttributeError: module ‘dominate.tags‘ has no attribute ‘input‘解决方法

    问题 在使用flask-bootstrap渲染表单时,报错AttributeError: module 'dominate.tags' has no attribute 'input'. 解决方法 修 ...

  6. module 'scipy.misc' has no attribute 'imresize'

    报错 module 'scipy.misc' has no attribute 'imresize' import scipy.misc scipy.misc.imresize(img, (im_he ...

  7. python 报错 AttributeError: module ‘time‘ has no attribute ‘clock 解决方法

    源码如下: #引入所需要的时间库 import datetime import time#程序计时器,启动计时器 start = time.clock()#中间是放置需要测试运行时间的程序代码#计算启 ...

  8. AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘

    在使用scip.misc.toimage保存文件的时候,报错说是scipy.misc没有toimage. 代码片段如下: scipy.misc.toimage(img, cmin=0, cmax=1) ...

  9. AttributeError系列之:AttributeError: module 'scipy.misc' has no attribute 'imread'报错问题

    这是读取图像数据流的函数,参数为图像路径. 由于scipy的更新,原来的一些方法已经在新版中不再支持,这种问题就是因为这种原因产生的: 主要解决办法有2种,一种是将scipy降级,另一种是将代码中涉及 ...

最新文章

  1. html下拉框由后端,select下拉框通过ajax获取后台的值
  2. linux终端定时器实验报告,定时器实验报告.doc
  3. 面试官:说出几个你熟悉的 Zookeeper 命令
  4. relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP
  5. html5 canvas 实现一个简单的叮当猫头部
  6. JavaScript实现使用二元运算符将两个数字相加fullAdder算法(附完整源码)
  7. 字符变量赋值规则_C#的变量、运算符
  8. VK Cup 2017 - Round 1
  9. SAP Cloud for Customer interaction center 呼叫中心集成
  10. 用g++编译生成动态连接库*.so的方法及连接
  11. 【代码模板】不存在的NOIP2016
  12. 第7章 PCA与梯度上升法 学习笔记上
  13. 正确重启计算机的方法,电脑不定时自动重启的处理方法
  14. 下载离线 Visual Studio 离线安装包
  15. Android音视频编码基础一
  16. HALCON学习论坛
  17. 9个可视化图表在线制作工具,总有一款适合你
  18. Tkinter编程应知应会(20)-主菜单
  19. springboot整合mybatis:Consider defining a bean of type 'com.mk.mapper.UserMapper'
  20. Summary for linux

热门文章

  1. #systemverilog# 之 event region 和 timeslot 仿真调度(二)
  2. 从小型机到x86:四川电信核心数据库迁移到虚拟化平台
  3. rtthread系统GDF450(BOOT+APP)
  4. shell编写一个简单的jmeter自动化压测脚本
  5. tlac100怎么添加ap_TL-AC100安装说明书
  6. 优化 Nginx HTTPS 延迟 - 看我如何让Nginx提速 30%的?
  7. js库Modernizr的介绍和使用
  8. 【Python】一篇文章学会def定义函数的可选参数,默认参数,有默认值的可选参数(保姆级注释)
  9. php中编码转换,php编码转换_php编码转换函数
  10. [好玩的CMD]CMD批处理绘制彩色的像素画