module ‘scipy.ndimage’ has no attribute ‘imread’

  • Post author:
  • Post category:其他




问题

#导入ndimage
from scipy import ndimage
#调用imread
fname = "images/" + my_image
image = np.array(ndimage.imread(fname))


报错:

module ‘scipy.ndimage’ has no attribute ‘imread’



环境


  1. Python

    版本:3.7.4

  2. scipy

    版本:1.2.1

  3. PIL

    版本:6.0.0



解决方案

方案一:

  1. 打开

    Cmd

    ,安装

    imageio
pip3 install imageio
  1. 调用

    imageio.imread
import imageio
fname = "images/" + my_image
image = np.array(imageio.imread(fname))

方案二:

from matplotlib.pyplot import imread



参考

[1]

scipy.misc module has no attribute imread?



版权声明:本文为WUDIxi原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。