pyinstaller --onefile --windowed --hidden-import=tkinter --hidden-import=PIL xx.py
pyinstaller --onefile --windowed xx.py
1、修改.spec文件
2、 binaries=[(‘C:/Python312/python312.dll’, ‘.’)],
3、执行:pyinstaller xxx.spec
PS:win7不支持运行python3.12的
Note that Python 3.12.5 cannot be used on Windows 7 or earlier.
https://www.python.org/downloads/windows/