Python报错module 'scipy.misc' has no attribute 'imresize'

解决办法:

安装Pillow包,命令如下:

pip install Pillow

然后重启python环境

Python报错module 'scipy.misc' has no attribute 'imread'

解决办法:

大部分解决办法都是说没有安装PIL第三方库,库名现在为Pillow,推荐直接使用命令pip install Pillow进行安装,但是我的问题并没有因此得到解决,还是继续报错AttributeError: module 'scipy.misc' has no attribute 'imread'。
经过查询和尝试,发现是scipy的版本问题, 降级到scipy==1.2.1就可以完美解决了。
命令如下:

pip install scipy==1.2.1

原因探究:

如果您查看的scipy.misc.imresize许多最新版本的文档scipy,则会在顶部找到以下内容:

imresize不推荐使用!

imresize在SciPy 1.0.0中已弃用,在1.3.0中将被删除。

改为使用枕头:numpy.array(Image.fromarray(arr).resize())。

1.3.0发行版是昨天发行的,因此,如果scipy今天在系统上下载,您可能已经获得了新版本,该新版本将无法再使用该功能。

我在上面引用的文档提出了一个代码片段(使用numpy和PIL),它可以替代。

所以出现以上类似问题的根本原因还是scipy版本的问题

Python报错module 'scipy.misc' has no attribute 'xxx'的更多相关文章

  1. Python报错——module 'scipy.misc' has no attribute 'imresize'

    报错是因为要安装PIL库,库名现在为Pillow,在命令行上安装即可: pip3 install Pillow

  2. module 'scipy.misc' has no attribute 'toimage',python

    anaconda环境下: 错误:python 命令行运行出错:module 'scipy.misc' has no attribute 'toimage' 解决:打开Anaconda prompt,输 ...

  3. AttributeError: module 'scipy.misc' has no attribute 'imread'

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

  4. Tensorflow机器学习入门——AttributeError: module 'scipy.misc' has no attribute 'toimage'

    这个bug的解决办法: import cv2 # scipy.misc.toimage(image_array).save('cifar10_data/raw/%d.jpg' % i) cv2.imw ...

  5. python报错“AttributeError: 'set' object has no attribute 'items'“

    作为才开始学爬虫的萌新,遇到了一个这样的错,很懵逼 后面到网络到处查看大佬的解决方法,才发现headers的请求头部信息有错误,headers是一个字典,不是字符串,所以报错了 原代码 headers ...

  6. Python报错ModuleNotFoundError: No module named 'numpy'

    转载:https://blog.csdn.net/qq_39779233/article/details/103224712 Python报错ModuleNotFoundError: No modul ...

  7. 学习笔记71—Python 报错处理集

    ****************************************************** 如有谬误,请联系指正.转载请注明出处. 联系方式: e-mail: heyi9069@gm ...

  8. Python报错总结丶自定义报错

    Python报错总结: 常见异常 1,NameError: name 'a' is not defined:未定义函数名             2,IndentationError: uninden ...

  9. selenium python 报错“ unable to find binary in default location”

    selenium python 报错如下: raise exception_class(message, screen, stacktrace)selenium.common.exceptions.W ...

随机推荐

  1. 王某的NLP之路前言

    感谢基友jayjay和海英学姐的指路,其实我的方向一直比较迷茫. 因为自己是会计学出身的,前三年也没接触编程,第一次接触还是在2016年,尝试用聚宽的量化接口,当时顺便学了python 的一点知识. ...

  2. @Valid与@Validated

    Spring Validation验证框架对参数的验证机制提供了@Validated(Spring's JSR-303规范,是标准JSR-303的一个变种),javax提供了@Valid(标准JSR- ...

  3. jmeter常见问题小结

    1,报500,查看信息头中的Content-Type 2,https的端口号是443 3,同一个线程组中,不同请求分别用到的字段都可以直接写在‘HTTP信息头管理器’中 4,Debug Sampler ...

  4. CDQ分治学习思考

    先挂上个大佬讲解,sunyutian1998学长给我推荐的mlystdcall大佬的[教程]简易CDQ分治教程&学习笔记 还有个B站小姐姐讲解的概念https://www.bilibili.c ...

  5. 修改 Idea 终端 Terminal 为 GitBash

    Terminal "C:\Program Files\Git\bin\sh.exe" -login -i

  6. permutation 2(递推 + 思维)

    permutation 2 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  7. require.context

    带表达式的 require 语句 如果你的 require参数含有表达式(expressions),会创建一个上下文(context),因为在编译时(compile time)并不清楚具体是哪一个模块 ...

  8. rabbitmq访问控制试坑篇

    访问控制我理解就是两层,第一层是Virtual host,相当于一个个独立主机 第二层是这个permissions,对照下图权限表 权限表(重要!) 需求 configgure write read ...

  9. websocket聊天体验(二)

    上一篇说到后续可以支持:最近历史.表情+图片,顺便还实现了简易的音频和视频.暂时没有实现实时语音对讲,有待后续再研究.点开在线聊天页面,即可看到最近历史记录(18条). 聊天的底层数据都是基于txt文 ...

  10. Java - 可循环队列

    队列是一种特殊的线性表,是一种先进先出的数据结构.只允许在表的前端进行删除操作,在表的后端进行插入操作.进行插入操作的端称为队尾,进行删除操作的端称为队头.队列中没有元素时,称为空队列. 简单的循环队 ...