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. Java 添加、删除、移动、隐藏/显示Excel工作表

    本文内容将介绍通过Java程序如何添加.删除.移动工作表,以及设置工作表隐藏.显示等操作.文中使用了Java Excel类库(Free Spire.XLS for Java 免费版),可通过官网下载包 ...

  2. 【Winform-自定义控件】 DataGridView多维表头

    [datagridview与treeview绑定] treeview            代码: DataTable dtable = new DataTable("Rock") ...

  3. MySQL错误:ERROR 1067 (42000): Invalid default value for 'timestamp_field'

    数据库报错   ERROR 1067 (42000): Invalid default value for 'start_time' 是因为数据库的配置有问题: 可以看到  NO_ZERO_IN_DA ...

  4. luogu【模板】线性筛素数 (Miller-Rabin素数测试模板)

    这个感觉还是挺好理解的,就是复杂度证明看不懂~ Code: #include <cstdio> #include <algorithm> #include <cstrin ...

  5. 9.一次简单的Web作业

    Web作业 <!DOCTYPE html> <!-- 作业描述:由于引用了JQuery库,所以请在联网的时候打开该页面. 本次作业是在上次作业的基础上的进一步完善,上次作业页面预留的 ...

  6. 查找:find、locate、which、whereis

    有find . locate . which . whereis 一.find 命令格式:[root@localhost ~]# find 搜索路径 [选项] 搜索内容 find是比较特殊的命令,它有 ...

  7. mysql5.7提示密码过期的解决方法

    首先把MySQL关闭 打开一个终端,输入 sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables 执行完命令后,再打开一个新的终端 sudo ...

  8. 「CSA Round #41」BFS-DFS

    题目链接 戳我 \(Description\) 给出一个图的\(bfs\)序和\(dfs\)序,构造出一个满足条件的图,边的扫描顺序为读入顺序 \(Solution\) 这个题还是很简单的. 先来看看 ...

  9. 8.3 CSS样式

    8.3 CSS样式 参考链接:http://how2j.cn/k/css2/css2-border/249.html 一.CSS有什么作用. 不使用css 给每一个单元格加上背景颜色 .就需要给每一个 ...

  10. Mybatis内置的日志工厂提供日志功能

    Mybatis内置的日志工厂提供日志功能,具体的日志实现有以下几种工具: SLF4J Apache Commons Logging Log4j 2 Log4j JDK logging 具体选择哪个日志 ...