AttributeError:模块“ PIL”没有属性“ Image”

时间:2019-04-23 10:28:50

标签: python

这是我的代码

import numpy as np
import PIL

list_im = ['Test1.jpg','Test2.jpg','Test3.jpg']
imgs    = [ PIL.Image.open(i) for i in list_im ]
# pick the image which is the smallest, and resize the others to match it (can be arbitrary image shape here)
min_shape = sorted( [(np.sum(i.size), i.size ) for i in imgs])[0][1]
imgs_comb = np.hstack( (np.asarray( i.resize(min_shape) ) for i in imgs ) )

# save that beautiful picture
imgs_comb = PIL.Image.fromarray( imgs_comb)
imgs_comb.save( 'Trifecta.jpg' )    

这是我的错误

enter image description here

我搜索了无效的解决方案,例如更新PIL软件包。

请帮我看看。先感谢您。

0 个答案:

没有答案