python打包Windows.exe程序(pyinstaller),-F:pyinsta


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

关于笔者: 我的主页

欢迎来我的51CTO主页踩一踩~ 我的51CTO博客

更多分享尽在我的订阅号:靠谱杨的挨踢生活

评论关闭