from PIL import Image Error: Issue getting during Image
from PIL import Image Error: Issue getting during Image
from tkinter import*
from tkinter import ttk
from tkinter import PIL
from PIL import Image
class Ab:
def __init__(self,root):
self.root=root
self.root.geometry("1530x790+0+0")
self.root.title("Management System")
if __name__=="__main__":
root=Tk()
obj=Ab(root)
root.mainloop()
I am getting an Error while importing PIL. I am not understanding this
error as I have already installed Pillow library.
我已经删除了 tkinter,但仍然观察到这个错误:ModuleNotFoundError:没有名为 'PIL' 的模块。
我已经安装了 Pillow 但出现此错误。
删除 from tkinter import PIL
。那应该可以解决问题。
您不能从 tkinter 导入 PIL,因为 PIL 是一个单独的 Python 图像库。
一旦你安装了 Pillow 库,你就可以直接使用 from PIL import Image
。在使用 PIL 提供的函数或对象之前,您无需将 PIL
添加到命名空间。
from tkinter import*
from tkinter import ttk
from tkinter import PIL
from PIL import Image
class Ab:
def __init__(self,root):
self.root=root
self.root.geometry("1530x790+0+0")
self.root.title("Management System")
if __name__=="__main__":
root=Tk()
obj=Ab(root)
root.mainloop()
I am getting an Error while importing PIL. I am not understanding this error as I have already installed Pillow library.
我已经删除了 tkinter,但仍然观察到这个错误:ModuleNotFoundError:没有名为 'PIL' 的模块。 我已经安装了 Pillow 但出现此错误。
删除 from tkinter import PIL
。那应该可以解决问题。
您不能从 tkinter 导入 PIL,因为 PIL 是一个单独的 Python 图像库。
一旦你安装了 Pillow 库,你就可以直接使用 from PIL import Image
。在使用 PIL 提供的函数或对象之前,您无需将 PIL
添加到命名空间。