py2exe打包报错ndexError: tuple index out of range

在Windows10环境下,使用py2exe0.9.2.2无法成功将Python3.6程序打包,出现tuple index out of range错误。分析表明py2exe不支持Python3.6的新字节码。解决方案是采用pyinstaller3.3.1进行打包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境windows10,64位,python3.6,py2exe0.9.2.2(最新的)
问题:py2exe打包报错ndexError: tuple index out of range.
分析:查了一下官方http://www.py2exe.org/ 和PYPI https://pypi.python.org/pypi/py2exe/0.9.2.2,        
说是支持,但多种方法尝试无用。又在SO看到https://stackoverflow.com/questions/41578808/python-indexerror-tuple-index-out-of-range-when-using-py2exe,贴出The failure you're seeing occurs in py2exe opcode parsing code, which, given the most recent posted version of py2exe only claims support for 3.3 and 3.4, could not possibly have knowledge of, or support for, the new wordcode opcodes; they hadn't even been conceived of at the time py2exe was last updated. The bytecode often changes in small ways from version to version that could break even Python 3.5 (given only 3.3 and 3.4 support is claimed explicitly), but 3.6 is 100% guaranteed to fail.存在版本不适用性,果断放弃py2exe.
解决:使用pyinstaller(3.3.1)打包,打包py3.6版本的程序没有问题。


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值