py2exe 使用
时间:2008-06-21 来源:lvxinzhi
新版本已经可以打包为一个文件了,以前都是一堆dll, pyd的。具体的变化其实只有一个地方。就是options里增加bundle_files项,值为1表示pyd和dll文件会被打包到exe文件中,且 不能从文件系统中加载python模块;值为2表示pyd和dll文件会被打包到exe文件中,但是可以从文件系统中加载python模块。另外 setup中使用zipfile=None可以不生成library.zip。
例如原来的:
例如原来的:
from distutils.core import setup
import py2exe
includes = ["encodings", "encodings.*"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
"includes": includes,
}
}
setup(
version = "0.1.0",
description = "search panda",
name = "search panda",
options = options,
windows=[{"script": "search.py", "icon_resources": [(1, "search.ico")] }],
)
只需要改为:
from distutils.core import setup
import py2exe
includes = ["encodings", "encodings.*"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
"includes": includes,
"bundle_files": 1
}
}
setup(
version = "0.1.0",
description = "search panda",
name = "search panda",
options = options,
zipfile=None,
windows=[{"script": "search.py", "icon_resources": [(1, "search.ico")] }],
)
相关阅读 更多 +