1、打包命令
# 将 xx.py 打包
pyinstaller -D xx.py
2、示例
还是使用这个示例代码:
# 先安装 pip install pysimplegui
import PySimpleGUI as sg
layout = [
[sg.Text('请输入内容:')],
[sg.InputText()],
[sg.Submit('确认'), sg.Cancel('取消')]
]
window = sg.Window('Demo示例', layout)
event, values = window.read()
text_input = values[0]
sg.popup('你输入了:', text_input)
运行命令,会在dist下生成一个和py文件同名的文件夹,这个就是我们打包出来的文件夹。
pyinstaller -D test.py
运行一下test.exe
试试看,效果如下:
完全没有问题!!!