用这种打包方式,会只生成bin文件,文件下只有一个exe,测试过是可以在其他地方运行的,即使没有安装python
from py2exe.build_exe import py2exe
from distutils.core import setup
from glob import glob
import py2exe
import os, sys
import shutil
if len(sys.argv) == 1:
sys.argv.append("py2exe")
includes = ["encodings", "encodings.*"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
"includes": includes,
"dist_dir": "bin",
"bundle_files": 1
}
}
setup(
version = "1.0",
description = u'xxxxx',#描述你这个exe的
name = "xxx",
options = options,
zipfile = None,
console=[{"script": "xxxx.py"}],
data_files=[]
)
os.remove("bin//w9xpopen.exe")
shutil.rmtree("build")
追问error: bundle-files 1 not yet supported on win64
running py2exe
出现提示,没支持?
追答看这提示是不支持win64的。
但我的系统是win8 64位的 ,没有问题啊。
要不你试试 PyInstaller 嘛,py的打包有几种,不定非要用py2exe