1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > imresize导入错误ImportError: cannot import name 'imresize'

imresize导入错误ImportError: cannot import name 'imresize'

时间:2021-02-16 22:03:41

相关推荐

imresize导入错误ImportError: cannot import name 'imresize'

python代码中导入imresize:

from scipy.misc import imresize

出现如下错误,无法导入:

ImportError: cannot import name 'imresize'

这是由于scipy版本问题导致的,在scipy 1.3.0之后的版本中将不再包含函数imresize:

imresize is deprecated! imresize is deprecated in SciPy 1.0.0, and will be removed in 1.3.0. Use Pillow instead: numpy.array(Image.fromarray(arr).resize()).

因此,为了使用imresize,需要将scipy降到早期的版本:

pip3 install scipy==1.1.0

问题解决。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。