Python 全栈:PyInstaller 打包过程详解

介绍

PyInstaller 能将一个应用程序打包为独立可执行的文件,比如 Windows 下打包为 exe 文件,详情可参考:

http://www.pyinstaller.org/

1574592883830

PyInstaller is a program that freezes (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.

PyInstaller 相比于同类的优势:

  • 支持 Python 2.7、Python 3.3-3.6;
  • 生成的可执行文件字节数更小;
  • 对第三方包的支持非常好,只需要将它们放到 Python 的解释器对应的文件夹中,PyInstaller 便可自动打包到最终生成的可执行文件中。

As an example, libraries like PyQt, Django or matplotlib are fully supported, without having to handle plugins or external data files manually. Check our compatibility list of Supported Packages for details.

安装 PyInstaller

使用下面命令:

PyInstaller from PyPI

以上是官网给出的安装方式,pip 安装会更简捷,因为它会自动安装 PyInstaller 的第三方库地依赖。

但是笔者在安装时,不是走的这种方式,而是下载 PyInstaller 的源文件:

http://www.pyinstaller.org/downloads.html

命令行界面中 cd 到 PyInstaller 的目录下,执行:

还有 52% 的精彩内容
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
支付 ¥1.99 继续阅读

推荐阅读更多精彩内容