I'm trying to use pyinstaller to make builds of a program I've been developing but I'm running into problems with the binary afterward. Here has been my procedure.
First I ran pyinstall test.py
Then I ran the binary using ./dist/main/test
but I get this error which I don't get when running the script normally (such as python3 test.py
).
Traceback (most recent call last):
File "PIL/ImageTk.py", line 181, in paste
_tkinter.TclError: invalid command name "PyImagingPhoto"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "magic-collection-tracker/test.py", line 22, in <module>
File "magic-collection-tracker/test.py", line 11, in main
File "PIL/ImageTk.py", line 120, in __init__
File "PIL/ImageTk.py", line 185, in paste
ModuleNotFoundError: No module named 'PIL._tkinter_finder'
Here is a minimal example that reproduces the issue.
from PIL import ImageTk
import PIL.Image
from tkinter import *
window = Tk()
pil_img = PIL.Image.open('./scr_images/blank_card.png')
tkimage = ImageTk.PhotoImage(pil_img)
canvas = Canvas(window)
canvas.create_image(0,0,image=tkimage, anchor=NW)
canvas.pack()
window.mainloop()
Am I using pyinstaller incorrectly or is there some other problem?