python pyinstaller打包exe程序

1.pyinstaller安装

安装环境:Win10
安装命令:

#升级pip版本
pip install -U pip
#安装pyinstaller
pip install pyinstaller
2.pyinstaller使用

1)选项参数

选项 描述
-h 显示帮助信息
-v 显示版本号
–distpath 指定打包后的程序存放目录,默认存放在当前目录下的dist目录
–workpath 为输出的所有临时文件指定存放目录
-c 显示命令行窗口
-w 不显示命令行窗口
-D 生成结果是一个包含exe程序的目录,所有第三方依赖库和其他资源和exe程序位于同一目录下
-F 生成结果是一个exe程序,所有第三方依赖库和其他资源都被打包进该exe程序中
-i 为生成的程序指定一个icon图标
-n 指定生成的.exe和.spec文件名

2)举例说明
在指定目录下新建一个test.py文件,执行如下命令

pyinstaller -F -w test.py --workpath temp --distpath . -n main

执行过程如下:
python pyinstaller打包exe程序_第1张图片
执行结果如下:
python pyinstaller打包exe程序_第2张图片

你可能感兴趣的:(python3)