《Pyinstaller打包教程》打包为文件夹

钟罗敏

关注

阅读 80

2022-02-24

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试试看,效果如下:
在这里插入图片描述
完全没有问题!!!

精彩评论(0)

0 0 举报