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文件
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文件


评论