解决:AttributeError: module ‘scipy.misc’ has no attribute ‘imread’报错问题

解决:AttributeError: module ‘scipy.misc’ has no attribute ‘imread’报错问题

以前的低版本还可以运行scipy.misc.imread(),我之前的程序是

def imread(path):
    return scipy.misc.imread(path).astype(np.float)`

安装了scipy的1.4.1版本后出现了AttributeError: module ‘scipy.misc’ has no attribute ‘imread’报错问题

解决方法:用另外一个包替换scipy包
将scipy替换成imageio包:直接 pip install imageio 安装即可

# 替换import scipy.misc
import imageio
# 替换scipy.misc.imread(path).astype(np.float)
imageio.imread(path).astype(np.float)

你可能感兴趣的:(scipy,opencv)