欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题

程序员文章站 2022-10-27 19:46:46
〇、前情提要在b站跟着up主 白手起家的百万富翁 学mnist手写体识别实践,但到了scipy.misc.toimage(image_array, cmin=0.0, cmax=1.0).save(image_file)报错AttributeError: module 'scipy.misc' has no attribute 'toimage'。参考:我的笔记-AttributeError: module ‘scipy.misc’ has no attribute ‘toimage’ht...

〇、前情提要

在b站跟着up主 白手起家的百万富翁 学mnist手写体识别实践,但到了scipy.misc.toimage(image_array, cmin=0.0, cmax=1.0).save(image_file)报错AttributeError: module 'scipy.misc' has no attribute 'toimage'
参考:

  1. 我的笔记-【TensorFlow】线性加权法-mnist手写体识别实践 笔记
    https://blog.csdn.net/weixin_43210113/article/details/107667417
  2. AttributeError: module ‘scipy.misc’ has no attribute ‘toimage’
    https://blog.csdn.net/lwc5411117/article/details/100654865?biz_id=102&utm_term=module%20scipy.misc%20has%20no%20attri&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-100654865&spm=1018.2118.3001.4187

一、问题发现

源代码

scipy.misc.toimage(image_array, cmin=0.0, cmax=1.0).save(image_file)

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题

报错

AttributeError: module 'scipy.misc' has no attribute 'toimage'

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题


二、方法一-降低scipy版本至1.1.0

找到环境,查找scipy版本

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题

右键选择新版本

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题

降级完毕

【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题


三、方法二-调用Pillow函数

引用

AttributeError: module ‘scipy.misc’ has no attribute ‘toimage’
https://blog.csdn.net/lwc5411117/article/details/100654865?biz_id=102&utm_term=module%20scipy.misc%20has%20no%20attri&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-100654865&spm=1018.2118.3001.4187


本文地址:https://blog.csdn.net/weixin_43210113/article/details/107673559

相关标签: TensorFlow python