`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``imageio.imread`` instead.

如题干所述,scipy 里面的 imread 读取图片会出错,代码如下:

from scipy import misc

misc.imread("picture/scipy子模块.png")

报错信息为:

D:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use ``imageio.imread`` instead.
  This is separate from the ipykernel package so we can avoid doing imports until

解决方法:

阅读以上报错信息,发现需要调用 imageio.imread ,而 scipy 中没有 scipy.imageio 子模块。

查阅相关信息,了解到,imageio 是一个独立的模块。

代码修改如下:

import imageio

imageio.imread("picture/scipy子模块.png")

 

上一篇:Java1.8基础学习之注解


下一篇:java – JVM是否会在运行时使用@deprecated代码发出警告?