Python调试笔记——AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘

问题

AttributeError: module ‘scipy.ndimage’ has no attribute ‘imread’
Python调试笔记——AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘_第1张图片

原因

scipy.ndimage老版本材有imread,之后的新版本已弃用
参见官方解释:
Python调试笔记——AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘_第2张图片

解决方案

import scipy.ndimage as image
img = image.imread('origin.jpg')

改成

import imageio
img = imageio.imread('origin.jpg')

顺利跑通~
Python调试笔记——AttributeError: module ‘scipy.ndimage‘ has no attribute ‘imread‘_第3张图片

你可能感兴趣的:(调试,Python)