参考: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

最新文章

  1. 一个难倒 3年 android开发经验 " 工程师 " 的 "bug"
  2. WinForm程序打包说明
  3. windows Server 2008 IE增强的安全配置关闭方法
  4. 在Eclipse中编写servlet时出现"The import javax.servlet cannot be resolved" 问题解决办法
  5. Spring-IOC之前世今生
  6. Linux之apt-get无sudo权限安装软件
  7. MySQL之学生名次问题
  8. Websocket和PHP Socket编程
  9. 【HDOJ】2155 小黑的镇魂曲
  10. Java基础知识强化之集合框架笔记40:Set集合之HashSet存储自定义对象并遍历
  11. 单个ViewController支持横屏,其他全竖屏方法-b
  12. cocos2dx 字体BMFont,Atlas
  13. 蚂蚁通讯框架SOFABolt之私有通讯协议设计
  14. supergridcontrol记录,分页
  15. MySQL 8 新特性之自增主键的持久化
  16. java ArrayList、Vector、LinkedList区别
  17. centos7 设置tomcat自启动
  18. Linux下稀疏文件的存储方式
  19. js调用.net后台事件,和后台调用前台等方法总结(转帖)
  20. svn各种箭头的含义

热门文章

  1. fonts.googleapis.com 加载慢的解决方法
  2. 转:C/C++程序员简历模板
  3. Evolutionary Computing: multi-objective optimisation
  4. [原创] Win7全自动精简批处理_绝对原创,绝对给力_感谢无忧给了我一年的潜水
  5. centos7 升级内核到最新版本
  6. IO流中SequenceInputStream类
  7. 0.读书笔记之The major advancements in Deep Learning in 2016
  8. 关于layui
  9. oracle 配置监听 windows下 oracle 12c
  10. java selenium验证元素是否存在