很好,有人知道我是否可以在脚本中制作exe单段代码,例如:
一个文件(hello.py):
print('hello word')
def exit():
print('good bye')
两个文件(setup.py):
from distutils.core import setup
import py2exe
import sys
import hello
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
options = {
#"bundle_files": 1,
"dll_excludes": ["w9xpopen.exe"] # we don't need this
}
setup(name = "python",
description = "aplicacion python",
version = "1.0",
console = [
{
"script":"hello.exit()",
#"icon_resources": [(0, "res_python.ico")]
}
],
options = {"py2exe": options},
zipfile = None,
)
为了更好的解释,我从同一个文件创建了 exe,谢谢。