我已经在python中创建了一个GUI(使用Tkinter),它使用os.system('python_file.py')从GUI上单击按钮来运行python文件。 。我想通过保持Tkinter文件为主,使用pyinstaller将所有这些python文件捆绑到一个.exe文件中。如何使用pyinstaller将多个python文件编译为单个.exe文件
我做创建的.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)
我不知道如何在上面的.spec文件中包含其他python文件,以便整个应用程序工作。有人可以帮忙吗?
您可以按照下列步骤操作:https://stackoverflow.com/a/37140662/5114581 –