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 ...
随机推荐
- Mac安装ctags
Mac安装ctags mac 系统有自带的ctags,但是不支持"ctags -R"指令,需要自己在安装Exuberant Ctags 1.下载ctags 2. 安装 ./conf ...
- bootstrap 分页表格插件
找了两个table的插件,一个是bootstrap table ,另一个是bootstrap-paginator 这里只介绍 bootstrap table 插件 使用及简单案例 文档介绍:http: ...
- 获取openid 的步骤
1.引导客户打开 https://open.weixin.qq.com/connect/oauth2/authorize?appid=appid &redirect_uri=https://w ...
- 用Broadcast广播在activity之间、fragment之间、activity和fragment之间相互传数据
例如:A界面要收到B界面的更变信息 一.A界面注册广播 private static final String INTENT_BROADCAST = "android.intent.acti ...
- JQuery实现table分页
1.直接贴代码: ; //每页显示的记录条数 ; //显示第curPage页 var len; //总行数 var page; //总页数 $(function(){ len =$(; //去掉表头 ...
- DFA敏感词过滤
import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.util.ArrayList; ...
- ubuntu16.04安装virtualbox5.1失败 gcc:error:unrecognized command line option ‘-fstack-protector-strong’
系统:ubuntu16.04.1 软件:Virtualbox-5.1 编译器:GCC 4.7.4 在如上环境下安装Vbx5.1提示我在终端执行/sbin/vboxconfig命令 照做 出现如下err ...
- Excel中提取最大值的问题
在使用excel的时候,碰到了一个如下的问题 意思是以每个字母为条件,取这个字母下面的数字中的最大值,需要注意一个问题是每个字母下面的数字个数不一定相等,例如d下面有四个数字,可以设置如下公式解决: ...
- beat your own python env
1,进入根目录,修改.bashrc,增加一个PATH目录 例如:alias cjtf='export PATH=/home/www/xxx/python_env:$PATH' 如果个人的机器的就不用a ...
- vim 编辑器使用积累(for win)
开个坑,记录一下使用vim的进化历程.这东西不是一两天用的精的,多用自然就觉得有很多地方需要进一步学习,慢慢的效率就上来了. 首先我大部分时间都是在win上做开发,win上的vim需要去自己去配置诸多 ...