python将代码打包成exe程序并添加图标的方法

tech2022-07-30  127

1.安装pyinstaller

pip --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller

尽量选择旧的版本,新的版本依赖比较多 2.使用pyinstaller打包程序

pyinstaller -F -w -i G:\automation\tpian.ico G:\automation\test.py -i 给应用程序添加图标-F 指定打包后只生成一个exe格式的文件-D –onedir 创建一个目录,包含exe文件,但会依赖很多文件(默认选项)-c –console, –nowindowed 使用控制台,无界面(默认)-w –windowed, –noconsole 使用窗口,无控制台-p 添加搜索路径
最新回复(0)