PyInstaller has a PIL directory, but the exe file throws an error "ModuleNotFoundError: No module named 'PIL'"

41 Views Asked by At

I wrote a program, that has line "from PIL import ImageTk, Image". I need to make an exe file from my .py file.

Pyinstaller has a PIL folder in its directory, but the program still throws an error "ModuleNotFoundError: No module named 'PIL'".

At first, I tried just "pyinstaller --onefile kryptocalc.py". That error occurs.

Then with --hidden-import=PIL. Error still occurs.

With --add-data="my path to PIL directory":PIL --hidden-import=PIL. Still the same.

Folder with PIL directory appeared in dist, but the error didn't disappear. PIL directory is located in the same folder as .py file.

0

There are 0 best solutions below