2008-05-06

python script 打包EXE例子

关键字: py2exe
最近公司让把几个python srcript的打包成EXE,查了一些资料,完成打包,总结一下:
1.安装py2exe插件

2. 新建一个setup.py 文件,文件内包含以下的代码
#!/usr/bin/python
# -*- coding: utf-8 -*-
# py2exe file
# 1.install py2exe application
# 2.python setup.py py2exe

from distutils.core import setup
import py2exe

includes = ["Action","CryptoUtil", "Phone" ,"PerformanceTest","SecureChannel"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
"includes": includes,
"bundle_files": 1
}
}
setup(
version = "0.1.0",
description = "Performance Test",
name = "Performance Test",
options = options,
zipfile=None,
console=["PerformanceTest.py"],data_files=["pt.ini"],

)
3. dos 下执行:python setup.py py2exe
4.执行成功后该文件夹会生成两个文件夹,查看dist文件夹即可看到exe文件
评论
88958620 2008-05-08
包含Python运行环境
clia 2008-05-07
强啊,打包出来的exe有多大,是否包含完整的Python运行时?
发表评论

您还没有登录,请登录后发表评论