当前位置:网站首页>Solve importerror: cannot import name 'imread' from 'SciPy misc‘

Solve importerror: cannot import name 'imread' from 'SciPy misc‘

2022-04-23 20:47:00 NuerNuer

Official explanation : scipy.misc.imread ( scipy.misc.imsave)  is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.

So the version is higher than 1.2.0 Of scipy It will report an error that the function cannot find , There are two solutions .

1. The official advice :
Use ``imageio.imwrite`` instead.
Use ``imageio.imread`` instead.

In the code import imageio, then

import imageio

imageio.imwrite('a.png', res)
b = imageio.imread('b.png')

2. to scipy Downgrade

pip install pillow==5.2.0
pip install scipy==1.1.0
# or  pip install scipy==1.0.0

I remember here pillow Also downgraded .

版权声明
本文为[NuerNuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210545522944.html