s
http://blog.csdn.net/xtx1990/article/details/7185289
src下创建文件sitecustomize.py
import sys
reload(sys)
sys.setdefaultencoding('utf8')
# coding=utf-8
import sitecustomize
users = [unicode(x,'utf-8') for x in users]
*.py中硬编码用u'中文'
if os.path.exists("apiTest1.exe"):
self.SetIcon(wx.Icon("apiTest1.exe", wx.BITMAP_TYPE_ICO))
else:
self.icon = wx.Icon('app.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon)
# coding=utf-8
from distutils.core import setup
import py2exe
#how to:
#cmd: python convert2exe.py py2exe
#cmd: upx -9 -f "app.exe"
#setup(windows=[{"script": "apiTest1.py"}])
includes = ["encodings", "encodings.*"]
options = {"py2exe":
{ "compressed": True,
"optimize": 2,
"includes": includes,
"bundle_files": 1
}
}
setup(
version = "0.1.0",
description = "apiTest",
name = "apiTest",
options = options,
zipfile=None,
windows=[{"script": "apiTest1.py","icon_resources": [(1, "app.ico")]}],
)
MSVCR71.dll大部分机器都有
不在98下运行,那就不要w9xpopen.exe
4、压缩程序。程序体积有点大,用upx压缩一下,执行命令upx -9 -f "app.exe"
http://ftp.pconline.com.cn/3a0b46f13d6f99f8b1fa73847df01254/pub/download/201010/upx308w.zip
s