Python的pyinstaller库
pyinstaller的安装
介绍:pyinstaller是Python的第三方库,主要用于将Python代码打包成 可执行文件 ,以此达到就算没安装Python也可运行代码目的
安装方法:有几种:
1.最简单是在命令行(就是cmd(默认是Windows,没了解Linux和Mac)输入 pip install pyinstaller ,但是这种办法可能会报错,因为这个依赖 pywin32
需要先安装pywin32输入pip install pywin32 ,还有其他错误参见:官方文档
em,更新版本也可以在cmd里更新输入 pip install --upgrade pyinstaller
b.再转cmd cd到解压文件目录里,输入 python setup.py install
3.最后可在cmd中输入 pip show pyinstaller 如果出现类似下面的文字就成功了
Name: pyinstaller
Version:3.5Summary: PyInstaller bundles a Python application and all its dependencies into a single package.
Home-page: http://www.pyinstaller.org
Author: Giovanni Bajo, Hartmut Goebel, David Vierra, David Cortesi, Martin Zibricky
Author-email: pyinstaller@googlegroups.com
License: GPL license with a special exception which allows to use PyInstaller to build and distribute non-freeprograms (including commercial ones)
Location: (**********这里是pyinstaller一些文件的路径***********)Requires: setuptools, altgraph, pywin32-ctypes, pefile
Required-by:
2. pyinstaller的使用 (详细的参考 pyinstaller的使用,这里只列举几个常用的)
1 -h, --help 显示此帮助消息并退出2 -v, --version 显示程序版本信息并退出。3 --distpath DIR 放置捆绑应用的位置(默认值:./did)4 --workpath WORKPATH 在哪里放置所有临时工作文件,.log,.pyz等(默认值:./build)5 -y, --noconfirm 替换输出目录(默认值:SPECPATH / dist /SPECNAME)而不要求确认6 --upx-dir UPX_DIR UPX实用程序的路径(默认:搜索执行路径)7 -a, --ascii 不包括unicode编码支持(默认值:如果可用,则包含)8 --clean 在构建之前清理PyInstaller缓存并删除临时文件。9 --log-level LEVEL 构建时控制台消息中的详细信息量。LEVEL可能是TRACE, DEBUG,INFO,WARN,ERROR,CRITICAL之一(默认值:INFO)。10 *******下面是一些关于生成文件的配置************
11 -D, --onedir 创建包含可执行文件的单文件夹包(默认)12 -F, --onefile 创建一个文件捆绑的可执行文件。13 --specpath DIR 用于存储生成的spec文件的文件夹(默认值:当前目录)14 -n NAME, --name NAME 要分配给捆绑应用程序和规范文件的名称(默认值:第一个脚本的基本名称)
3.关于生成可执行文件的icon添加办法
--------------------------------------------------------this not is the end of this article ---------------------------------