Pyinstaller打包生成可执行程序
来源:互联网 发布:pdf转换图片软件 编辑:程序博客网 时间:2024/05/17 08:59
安装:
sudo pip install pyinstaller
也可以下载安装:
https://sourceforge.net/projects/pyinstaller/
Pyinstaller命令的基本形式为:
pyinstaller [options] script [script ...] | specfile
使用
pyinstaller myscript.py
Pyinstaller将分析myscript.py文件.然后将myscript.spec文件写入与py文件同名的文件夹(myscript文件夹.)在该文件夹中创建build文件夹.在build文件夹中写入log文件和工作文件.之后在myscript中创建dist文件夹,将myscript可执行文件写入到dist文件夹.
一般情况下pyinstaller后面只指定一个py文件.如果指定了多个py文件,所有的文件都会被分析,并生成输出文件.但是所有的输出文件都会保存到第一个py文件名所命名的输出文件夹中.Pyinstaller myscript.py myscript1.py myscript2.py
运行后,只生成一个myscript的文件夹中,里面包含了对这三个文件分析后生成的输出文件.
此外,还可以编辑myscript.spec文件,编辑后就可以直接编译spec文件(而不是py文件):pyinstaller myscript.spec
如果py文件不在当前路径下,可以用下面命令编译:
`pyinstaller options.. ~/path/to/script/myscript.py
Pyinstaller命令运行参数包括:
-F, --onefile Py代码只有一个文件
-D, --onedir Py代码放在一个目录中(默认是这个)
-K, --tk 包含TCL/TK
-d, --debug 生成debug模式的exe文件
-w, --windowed, --noconsole 窗体exe文件(WindowsOnly)
-c, --nowindowed, --console 控制台exe文件(WindowsOnly)
-X, --upx 使用upx压缩exe文件
-o DIR, --out=DIR 设置spec文件输出的目录,默认在PyInstaller同目录
-v FILE, --version=FILE 加入版本信息文件
特别要注意的是,当前的pyinstaller还不支持python3.6版本.虽然支持3.6的还没有发布,但是可以手动安装https://github.com/pyinstalle... 下载zip后把PyInstaller提出来。删掉python/Lib/site-packages/PyInstaller 文件夹,把解压得到的PyInstaller放进去应该就OK了。#_#
(值得试一试!)
拿matplotlib官网的例子animate_decay成功生成了linux下的可执行文件.
Pyinstaller -F animate_decay.py
在dist文件下,可以找到animate_decay可执行文件.运行:
./animate_decay
参考:
http://www.jianshu.com/p/3b10c6664706
http://kevinhao.blog.51cto.com/5204735/1704411
https://segmentfault.com/q/1010000009242914
- Pyinstaller打包生成可执行程序
- 用PyInstaller把python程序打包成exe可执行程序
- pyinstaller将Python脚本打包成可执行程序
- PyInstaller打包python程序
- Python程序打包--PyInstaller
- 使用 pyinstaller 把python脚本打包成 windows exe 可执行程序
- python 打包程序 pyinstaller py2exe
- PyInstaller-2.1打包python程序
- 利用pyinstaller打包python3程序
- 使用PyInstaller打包Python程序
- PyInstaller打包Python程序详解
- 使用pyInstaller打包python脚本为可执行exe
- 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- 用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- 使用 PyInstaller 把python程序 .py转为 .exe 可执行程序
- golang内置库常用方法笔记
- python和fortran的接口
- 大数据架构hadoop初体验二
- python爬虫: 爬一个英语学习网站
- sphinx语音识别(1)-基本介绍
- Pyinstaller打包生成可执行程序
- 多人脸部\肢体\手部识别OpenPose安装
- 【java笔试系列五】List、Set和Map
- 数据分析中的可视化-常见图形
- Tableau连接kylin
- Oracle 12c ORA-28040 没有匹配的认证协议
- 硬连接与软连接
- request获取请求头消息
- Eigen demo与文件读写 汇总