+ 1
ModuleNotFoundError: No module named 'PIL'
I convert .py to .exe using this command -> pyinstaller --onefile -w file.py After i launch file.exe i get error "Failed to execute script 'file' due to unhandled exception: No module named 'PIL' ", Traceback (most recent call last): File "file.py", line 2, in <module> ModuleNotFoundError: No module named 'PIL' I have reinstalled Pillow 2 times, didnt help Code: from tkinter import * from PIL import ImageTk, Image root=Tk() root.geometry('700x600') path='C:\\Users\\user\\OneDrive\\Рабочий стол\\Python + Setup master\\Python\\anchor.PNG' img=ImageTk.PhotoImage(Image.open(path)) lab=Label(root, image=img) lab.pack() root.mainloop(
10 odpowiedzi
+ 1
Have you ran the code in an interpreter to see if it actually works?
+ 1
is there any other way to make .py tp .exe without pyinstaller? Somewhy pyinstaller throws error to any code which has "match: case" or PIL in it ( atleast for me)
0
Yeah, it does.
0
than it's something with pyinstaller. Just run your codes from the command prompt or learn how to write a short script that will run the code when you double click the icon.
0
I do .exe file so i can turn it to setup using another program.
Btw pyinstaller works fine if programs is not using any images
0
I've used it before, it usually works fine. Not sure about the reasoning though. Have you checked out pyqt5 framework? Pretty simple if you're comfortable with tkinter building. It's all the same with frames within frames within the main window. And the labels and buttons and such can be coded ao easily. I think it has it's own multi platform builder too
0
I've heard about pyqt5, but haven't tried it, decided to learn tkinter first
0
[SOLVED] If we use auto-py-to-exe everything works, but file size is huge ( for example, this litlle code to display 1 pic takes 70 megabytes)
0
Artur For Your Information
auto-py-to-exe executes PyInstaller command for the conversion, it only provides a gui window to speed out the process and make it easier to add information related to software like version history, files, etc.
So the problem was either in your command or your python version or your code
0
Its kind of weird, commands executed by auto-py-exe and pyinstaller are the same, yet pyinstaller throws error and auto-py-exe works fine