【转】python打包py2exe和pyinstaller

【转】http://www.cnblogs.com/belid/archive/2013/05/03/3056854.html

一 py2exe安装使用简介

1.py2exe安装,http://prdownloads.sourceforge.net/py2exe 选择对应的python版本去安装

2.使用,新建一个setup.py文件

复制代码
#coding=utf-8
from distutils.core import setup
import py2exe

includes = ["encodings", "encodings.*"]
options = {"py2exe":
{"compressed": 1,
"optimize": 2,
"ascii": 1,
"includes":includes,
"bundle_files": 1              #只生产一个exe文件
}
}

setup(name="setup.exe",
options=options,
zipfile=None,         #不生成zip文件
console=["setup.py"])
复制代码

然后进入目录在执行python setup.py py2exe,会生成一个build和dist目录,在dist目录下有setup.exe程序。

二 pyinstaller安装使用简介

 1.安装pyintaller的一个依赖包,http://sourceforge.net/projects/pywin32/files/。

2.去http://www.pyinstaller.org/下载pyintaller,然后解压。

3.进入解压目录执行 python Configure.py (第一次使用才执行)

4.进入程序的目录执行python  pathtopyinstaller/Makespec.py  -F  setup.py 生成setup.spec文件。-F是只生产一个可执行程序。

5.执行python pathtopyinstaller/Build.py setup.spec 会在dist目录生成一个setup.exe可执行程序。

pathtopyinstaller 安装pythoninstall路径

转载于:https://www.cnblogs.com/Judge-Death/p/5673952.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值