AttributeError:模块'PIL.ImageFile文件'没有属性'ImageFile'

2024-05-14 20:21:22 发布

您现在位置:Python中文网/ 问答频道 /正文

AttributeError:模块'PIL.ImageFile文件'没有属性'ImageFile'

我用“pip install pillow”命令安装了PIL

From PIL import Image
sourceFileName = "source.png"
Avatar= Image.open(sourceFileName)
File "d:/sourcecode/test.py", line 3, in <module>
   Avatar= Image.open(sourceFileName)
File "C:\**\Python37-32\lib\site-packages\PIL\Image.py", line 2663, in open
   Preinit()
File "C:\**\Python37-32\lib\site-packages\PIL\Image.py", line 381, in preinit
   From . import BmpImagePlugin
File "C:\**\Python37-32\lib\site-packages\PIL\BmpImagePlugin.py", line 61, in <module>
   Class BmpImageFile(ImageFile.ImageFile):
AttributeError: module 'PIL.ImageFile' has no attribute 'ImageFile'

Tags: inpyimagepillibpackageslinesite

热门问题