0
点赞
收藏
分享

微信扫一扫

AttributeError: module 'scipy.misc' has no attribute 'imread'


问题:

Traceback (most recent call last):
File "compare.py", line 130, in <module>
main(parse_arguments(sys.argv[1:]))
File "compare.py", line 41, in main
images = load_and_align_data(args.image_files,
args.image_size, args.margin, args.gpu_memory_fraction)
File "compare.py", line 95, in load_and_align_data
img = misc.imread(os.path.expanduser(image), mode='RGB')
AttributeError: module 'scipy.misc' has no attribute 'imread'

使用了1和2,成功解决问题

原因1:

Install the Pillow library by following commands:

pip install pillow

Note, the selected answer has been outdated. See the docs of SciPy

Note that Pillow (​​https://python-pillow.org/​​) is not a dependency of SciPy, but the image manipulation functions indicated in the list below are not available without it.

原因2:

imread is depreciated after version 1.2.0! So to solve this issue I had to install version 1.1.0.

pip install scipy==1.1.0

原因3(未试):

For Python 3, it is best to use imread in matplotlib.pyplot:

from matplotlib.pyplot import

参考:​​https://stackoverflow.com/questions/15345790/scipy-misc-module-has-no-attribute-imread​​


举报

相关推荐

0 条评论