wxpython打包exe运行异常中断_wx.progress对话框+py2exe导致应用程序崩溃

py2exe(0.6.9)已经很过时了,如果不做一些额外的修改,就不能很好地处理较新的Windows版本。特别是,默认情况下,它将包含一些不应该绑定的Windows系统dll。要防止出现这种情况,请尝试按如下方式更改安装脚本:from distutils.core import setup

import py2exe

# Exclude system DLLs

origIsSystemDLL = py2exe.build_exe.isSystemDLL

def isSystemDLL(pathname):

if os.path.basename(pathname).lower() in ("gdiplus.dll",

"mfc90.dll"):

return 0

if os.path.basename(pathname).lower() in ("powrprof.dll", ) or \

os.path.basename(pathname).lower().startswith("api-ms-win-"):

return 1

return origIsSystemDLL(pathname)

py2exe.build_exe.isSystemDLL = isSystemDLL

# Add the MS VC9 CRT and common controls manifest as resource to the exe

manifest = '''<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

version="0.0.0.0"

processorArchitecture="x86"

name="Enter program name here"

type="win32"

/>

Enter program description here

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="x86"

publicKeyToken="6595b64144ccf1df"

language="*"

/>

type="win32"

name="Microsoft.VC90.CRT"

version="9.0.21022.8"

processorArchitecture="x86"

publicKeyToken="1fc8b3b9a1e18e3b"

/>

'''

setup(script_args=['py2exe'],

windows=[{'script': 'progressdlgprobblem.py',

'other_resources': [(24, 1, manifest)]}],

options = {'py2exe': {'compressed': 1,

'dll_excludes': ['iertutil.dll',

'MPR.dll',

'msvcm90.dll',

'msvcp90.dll',

'msvcr90.dll',

'mswsock.dll',

'urlmon.dll',

'w9xpopen.exe'],

'bundle_files': 1}},

zipfile=None)

为了获得最佳的互操作性,您还需要复制微软.VC90.CRT.舱单,msvcm90.dll、msvcp90.dll和msvcr90.dll(来自C:\Windows\winsxs\x86)_微软.vc90.crt_1fc8b3b9ae118e3b_9.0.21022.8_none_bcb86ed6ac711f91(目录名可能略有不同,但是正确的版本9.0.21022.8是很重要的)到你的exe目录,这样用户就不需要自己安装正确版本的MS VC9 CRT。在

除此之外,您还可以尝试PyInstaller,它可以自动处理程序集依赖项,并在默认情况下排除系统dll。在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值