更新时间:2023-12-05 08:43:22
检查 https://github.com/pyinstaller/pyinstaller/issues/1584.PIL 钩子存在问题,它不包括 tkinter 模块.
Check https://github.com/pyinstaller/pyinstaller/issues/1584. There is an issue with the PIL hook, which excludes the tkinter module.
一种解决方案是通过从 excludeimports 中删除 modname_tkinter 来修改位于 YourPythonFolder\Lib\site-packages\PyInstaller\hooks 中的钩子文件 hook-PIL.py.
One solution is to modify the hook file hook-PIL.py located in YourPythonFolder\Lib\site-packages\PyInstaller\hooks by removing the modname_tkinter from excludedimports.
或者只是更改代码中导入语句的顺序.做:
Or just change the order of the import statements in your code. Do:
from PIL import ImageTk
import Tkinter as tk