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 用法

时间: 2024-08-24 14:10:50

pyinstaller 用法的相关文章

pyinstaller相关用法

万物都从易到难 先来讲一讲最简单的pyinstaller方法 1.注意点: a.所有的涉及要进行挎包的文件,pyinstaller默认有__init__.py才进行挎包操作,需要在包内检查有没有__init__.py b.注意是否有类似pymysql之类的包,若有请pass至复杂打包方式 c.至于纯静态的文件such as db文件没有打包进去,请手动放置到dist下的第一层目录 d.动态在工程里生成的文件如log需打包后建好文件夹 此命令打包的程序带console窗口 pyinstaller

pyinstaller 简单用法

pip install pyinstaller pyinstaller -F C:\User\Administrator\Desktop\test.py -n 脚本v1版 -F 生成单个exe文件 py文件的路径 -n 生成的exe程序改名称为 原文地址:https://www.cnblogs.com/2012-dream/p/11988318.html

用python加cPAMIE加pyinstaller为我柱哥点赞

我南开龙队长柱哥博士毕业,在京创业,参加了一个创业比赛,然后我打算写个小工具帮柱哥点个赞. 这里要用到的工具一个是python已经安装了,还需要cPAMIE和pyinstaller cPAMIE是一位大牛写的python的IE扩展,和方便操作IE浏览器,下载地址: http://nchc.dl.sourceforge.net/project/pamie/PAMIE/cPAMIE2.0/pamie20.zip 在windows下安装cPAMIE是很方便的,运行他的exe就行了,往往不成功,因为前提

Python - 使用Pyinstaller将Python代码生成可执行文件

1 - Pyinstaller简介 Home-page: http://www.pyinstaller.org PyInstaller是一个能够在多系统平台(Windows.*NIX.Mac OS)上将Python程序冻结(打包)为独立可执行文件的工具. 可以捆绑所需的第三方库,并可与绝大多数常见的库和框架配合使用: 可以与Python2.7和3.3-3.6协同工作,由于透明压缩而构建了更小的可执行文件: 使用OS支持来加载动态库,从而确保完全兼容: 2 - Pyinstaller安装 $ pi

将python程序打包成exe( pyintaller) 的用法

当我们用python写好一个脚本给没安装python解释器的windows用户使用时,那将无法执行脚本! 而 pyinstaller 就是一个帮助我们将python程序打包成 exe 可执行文件给没安装python解释器的用户使用的神器! 要使用 pyinstaller ,我们首先得安装它: 使用 pip 安装: pip install pyinstaller GitHub源码地址 安装完成后,我们先来检查下是否成功安装! pyinstaller -v 若显示出版本号,则证明我们已经成功安装了!

最详细的Python打包工具:Pyinstaller实战指南,如丝滑般体验

写了个吊炸天的Python项目,把我和左手相处的时间都赔上了.但出于版权考虑,我不太想让使用方直接用我的代码,毕竟Python代码给出去,就真的收不回来了. 想给客户演示的时候,不想那么墨迹的打开dos cmd 或者 terminal ,然后运行 python app.py 这样的命令行.最好是客户双击,完事儿.就像有人在那自己动一样-- PyInstaller 来了,他就是这么一款帮助我们把整个项目完整打包的工具.目前已经兼容Py3.7,以及 Mac App 和 Windows Exe. 文档

Python3快速入门(十八)——PyInstaller打包发布

Python3快速入门(十八)--PyInstaller打包发布 一.PyInstaller简介 1.PyInstaller简介 PyInstaller是一个跨平台的Python应用打包工具,支持 Windows/Linux/MacOS三大主流平台,能够把 Python 脚本及其所在的 Python 解释器打包成可执行文件,从而允许最终用户在无需安装 Python 的情况下执行应用程序.PyInstaller 制作出来的执行文件并不是跨平台的,如果需要为不同平台打包,就要在相应平台上运行PyIn

Python—脚本程序生成exe可执行程序(pyinstaller)

一.pyinstaller简介 Python是一个脚本语言,被解释器解释执行.它的发布方式: .py文件:对于开源项目或者源码没那么重要的,直接提供源码,需要使用者自行安装Python并且安装依赖的各种库.(Python官方的各种安装包就是这样做的). .pyc文件:有些公司或个人因为机密或者各种原因,不愿意源码被运行者看到,可以使用pyc文件发布,pyc文件是Python解释器可以识别的二进制码,故发布后也是跨平台的,需要使用者安装相应版本的Python和依赖库. 可执行文件:对于非码农用户或

js中获取时间new date()的用法

js中获取时间new date()的用法 获取时间:   var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getFullYear(); //获取完整的年份(4位,1970-????) 3 myDate.getMonth(); //获取当前月份(0-11,0代表1月) 4 myDate.getDate(); //获取当前日(1-31) 5 myDate.getDay();