pyinstaller 用法
参考:http://pythonhosted.org/PyInstaller/#installing-pyinstaller
1、下载pyinstaller和PyWin32
目前pyinstaller支持的python版本为2.3-2.7,可以到http://www.pyinstaller.org/官网下载。注意PyWin32 对应不太的python版本
2、安装
pyinstaller下载完成后,解压即可。PyWin32 安装
3、pyinstaller使用方法
使用也非常的简单,cmd下进入解压出来的目录,进入当前目录,比方说解压到d:/pyinstaller/,执行
方法一:当前目录下没有spec文件,执行
python pyinstaller.py [opts] yourprogram.py
- 方括号[]里面为可选项,
- 执行目录后,在d:/pyinstaller/目录里面生成一个your-program/dist子目录,你有用的文件就放在这里了,
- 同时生成一个your-program/your-program.spec文件
- 同时生成一个your-program/build,里面存放buid文件(中间件)
- 如果程序不在“d:/pyinstaller/”里面,指定程序的路径,spec,dist,buid目录文件将在当前目录下生成
方法一:当前目录下有spec文件,执行
python pyinstaller.py [opts] your-program.spec
4 主要选项包括:
Allowed OPTIONS are:
-h, --help show this help message and exit
-v, --version show program version
--upx-dir=UPX_DIR Directory containing UPX.
-a, --ascii do NOT include unicode encodings (default:
included if available)
--buildpath=BUILDPATH Buildpath (default:
SPECPATH/build/pyi.TARGET_PLATFORM/SPECNAME)
-y, --noconfirm Remove output directory (default:
SPECPATH/dist/SPECNAME) without
confirmation
--log-level=LOGLEVEL Log level (default: INFO, choose one of DEBUG,
INFO, WARN, ERROR, CRITICAL
What to generate:
-F, --onefile create a single file deployment
-D, --onedir create a single directory deployment (default)
-o DIR, --out=DIR create the spec file in directory. If not specified,
and the current directory is Installer's root
directory, an output subdirectory will be created.
Otherwise the current directory is used.
-n NAME, --name=NAME optional name to assign to the project (from which
the spec file name is generated). If omitted, the
basename of the (first) script is used.
-F, –onefile 打包成一个exe文件。
-D, –onedir 创建一个目录,包含exe文件,但会依赖很多文件(默认选项)。
-c, –console, –nowindowed 使用控制台,无界面(默认)
-w, –windowed, –noconsole 使用窗口,无控制台
具体参考PyInstaller安装目录下的PyInstaller Manual
pyinstaller 用法的更多相关文章
- PyInstaller用法
pyinstaller定义:PyInstaller是一个压缩python文件成为可执行程序的一个软件. pyinstaller工作原理:① 它会扫描你所有的Python文档,并分析所有代码从而找出所有 ...
- python打包exe之pyinstaller用法
pyinstaller可以将python写好的脚本打包成exe文件,方便windows用户在没有python环境下运行.这个程序完全跨平台,包括Windows.Linux.Mac OS X等多个操作系 ...
- Python打包—Pyinstaller
2018-09-27 21:12:05 一 前言 在windows平台学习python的过程中,你肯定会遇到需要把.py脚本打包成.exe的情形,如此,至少有两方面的好处:第一,你的代码保密性更好 ...
- 01.如何把.py文件打包成为exe,重点讲解pyinstaller的用法
1.应用场景 1.1 故事背景 我自己用python写了一个小程序发给其他同事用,给他的就是一个.py文件,不过他觉得比较麻烦,还要安装环境,他问我有没有简单一点的方式,我给一个exe文件,他就不用安 ...
- $python打包工具pyinstaller的用法
pyinstaller是一个很好用的python打包工具,在Windows环境下可以将python脚本打包成一个exe可执行文件,并且脚本中所依赖的各种第三方库在打包时候都会被统一处理到一起,这样打包 ...
- Python - 使用Pyinstaller将Python代码生成可执行文件
1 - Pyinstaller简介 Home-page: http://www.pyinstaller.org PyInstaller是一个能够在多系统平台(Windows.*NIX.Mac OS)上 ...
- 打包pyinstaller
安装:pip3 install pyinstaller 了解几个常用命令 参数 用处 -F 将程序打包成一个文件 -w 去除黑框 -i 添加程序图标 我们将需要打包的test.py文件放到桌面上,之后 ...
- 树莓派(Raspbian系统)中使用pyinstaller封装Python代码为可执行程序
一.前言 将做好的Python软件运行在树莓派上时,不想公开源码,就需要对文件进行封装(或称打包),本文主要介绍使用pyinstaller封装Python代码为可执行程序. Python是一个脚本语言 ...
- pyinstaller linux系统下打包python源文件
将python程序放在其他linux服务器中执行,通常linux服务器中默认安装python2.6,很多情况下需要升级为2.7 且要安装程序中需要的第三方模块,配置较为麻烦,所以通过在本地linux ...
随机推荐
- pinpoint 安装部署
.markdown-preview:not([data-use-github-style]) { padding: 2em; font-size: 1.2em; color: rgb(171, 178 ...
- unity自带寻路Navmesh入门教程(三)
继续介绍NavMesh寻路的功能,接下来阿赵打算讲一下以下两个例子,先看看完成的效果: 第一个例子对于喜欢DOTA的朋友应该很熟悉了,就是不同小队分不同路线进攻的寻路,红绿蓝三个队伍分别根据三条路 ...
- js操作新添加的DOM的问题
$(function(){ $("body").on("click", '.abc', function(){ alert('ok'); }); $('.b') ...
- Loading加载小插件,用户可以选择html格式或canvas格式,自定义loading图片,canvas色彩搭配可根据个人喜好
;(function($) { $.Loading = function(options) { //暴漏插件默认值 $.Loading.defaults = { speed: 200, //弹出层淡出 ...
- python3 文件增删查
#Author by Andy#_*_ coding:utf-8 _*_import sysimport timePath="E:\my python study\\files\haprox ...
- html / css打印样式
最近做公司后台系统,需要打印贴箱标签,按照正常打印A4纸的标准,测试的效果不是自己想要的,文字排版布局都乱了,查了一些资料,需要设置的东西我总结了一下: 显示器(screen)和打印机(printer ...
- excel读取
一.jar包 二.工具类 package excel; import java.io.FileInputStream; import java.io.FileNotFoundException; im ...
- 3个sprint的团队贡献分
第一次冲刺贡献分 成员名字 贡献分 101丘娟 23 108周诗琦 26 107杨晓霞 24 124陈程 27 第二次冲刺贡献分 成员名字 贡献分 101丘娟 23 108周诗琦 27 ...
- 收集C#常用类:自己写的一个DBHelper类
随着学的东西越来越多,一点点的完善吧! using System; using System.Collections.Generic; using System.Linq; using System. ...
- loadrunner获取当前CST时间
第一种方法:使用LR的参数化功能. 代码如下,nowtime是保存当前CST时间的字符串变量,local_time是要参数化的变量. Action() { char *nowtime; nowtime ...