Search code examples
pythonpycharmpyinstallerexeauto-py-to-exe

Pyinstaller error when I convert to Python


I had a error I can't do anything with. when I convert python to exe and follow the debug using --debug I saw this error

ModuleNotFoundError: No module named 'PIL'

with another error said

FileNotFoundError: [Errno 2] No such file or directory: 'sos.gif' 

Although I installed pillow

I appreciate your time


Solution

  • Thanks to everyone who tried to answer, I found out that the error was in the incorrect installation of pyinstaller. I reinstalled it. Then I replace the code from

    image = ImageTk.PhotoImage(Image.open("sos.gif"))
    

    TO

    image = ImageTk.PhotoImage(Image.open(r'C:\Users\****\Desktop\sos.gif'))
    

    after these steps it's working because when converted to exe program misses the image. to avoid this you should write where this image