第16章 pyinstaller库的使用

pyinstaller库概述

将.py源代码,转换成无需源代码的可执行文件

.py文件通过pyinstaller转换成windows、linux以及mac的可执行文件

pyinstaller库是第三方库

1、官方网站:http://www.pyinstaller.org

2、第三方库:使用前需要额外安装

3、安装第三方库需要使用pip工具

pyinstaller库的安装:

(cmd命令行) pip install pyinstaller

简单的使用说明:

(cmd命令行)pyinstaller -F <文件名.py>

然后在生成的dist文件夹下可以看到可执行文件exe,如下图所示:

pyinstaller库常用参数:

参数 描述
-h 查看帮助
--clean 清理打包过程中的临时文件
-D,--onedir 默认值,生成dist文件夹
-F,--onefile 在dist文件夹中只生成独立的打包文件
-i <图标文件名.ico> 指定打包程序使用的图标icon文件

 

 使用举例:

1 pyinstaller -i curve.ico -F SevenDigitsDrawV2.py

结果如下:

posted @ 2018-08-10 20:32  chy8  阅读(269)  评论(0编辑  收藏  举报