我已经在 python 中创建了一个 GUI(使用 Tkinter),并且使用 os.system('python_file.py') 从 GUI 单击按钮即可运行 python 文件。我想使用 pyinstaller 将所有这些 python 文件捆绑到单个 .exe 文件中,并将 Tkinter 文件保留为主文件。
我通过在命令行中执行以下操作创建了 .exe 文件:
pyinstaller --debug --onefile --noupx tkinter_app.py
目前我的 .spec 文件如下所示:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['tkinter_app.py'],pathex=['C:\\test'],binaries=[],datas=[],
hiddenimports=[],hookspath=[],runtime_hooks=[],excludes=[], win_no_prefer_redirects=False,
win_private_assemblies=False, cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name='tkinter_app', debug=True, strip=False, upx=False,console=True )
我不确定如何将其他 python 文件包含在上面的 .spec 文件中,以便整个应用程序正常工作。有人可以帮忙吗?