ImportError:无法从“ PIL”导入名称“ _imaging”

时间:2019-10-26 18:06:19

标签: python-3.x tkinter python-imaging-library

from tkinter import *
from PIL import Image, ImageTk

root = Tk()
root.geometry("1255x944")
photo = PhotoImage(file="photo.png")

lab = Label(image=photo)
lab.pack()

root.mainloop()

这是我的代码

错误是:

Traceback (most recent call last):
  File "/home/itachi/PycharmProjects/GUI_course/gui1_initialize.py", line 3, in <module>
    from PIL import Image, ImageTk
  File "/usr/lib/python3/dist-packages/PIL/Image.py", line 60, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)

Process finished with exit code 1

0 个答案:

没有答案