落根 发表于 2023-7-9 14:01:25

python打包Windows.exe程序(pyinstaller)

python打包Windows.exe程序(pyinstaller)
基础命令

pip install pyinstaller 使用pip命令来安装pyinstaller模块。
-F:pyinstaller -F hello.py -p hello2.py
-D:pyinstaller -D hello.py -p hello2.py
-i:pyinstaller -i tb.ico -F hello.py -p hello2.py
其中前一个文件hello是主文件,后一个文件是会被调用到的文件,可以有多个。
参数描述-F生成一个可执行文件-D生成一个目录(包含多个文件)作为可执行文件-w运行exe时,不显示命令行窗口(仅对Windows有效)-i该参数后跟可执行文件的icon图标路径–distpath该参数后跟可执行文件的路径-n该参数后跟可执行文件的新名字-F和-D参数的区别

-F 是指生成单个可执行的.exe文件,
-D 是指把.exe需要的资源和这个文件放在一起,见下图:

-i 参数

pyinstaller -i tb.ico -F hello.py -p hello2.py

可以看到,用这个命令生成的.exe文件的图标就已经变了。

生成的文件目录



来源:https://www.cnblogs.com/rainbow-1/p/17538739.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: python打包Windows.exe程序(pyinstaller)