Pyinstaller: IndexError: tuple index out of range

Windows下使用Python3.10时,Pyinstaller出现IndexError: tuple index out of range错误。

解决办法

修改C:\Program Files\Python\lib\dis.py文件,找到_unpack_opargs函数,在倒数第二行中添加extended_arg = 0即可,修改后的代码如下:

def _unpack_opargs(code):
    extended_arg = 0
    for i in range(0, len(code), 2):
        op = code[i]
        if op >= HAVE_ARGUMENT:
            arg = code[i+1] | extended_arg
            extended_arg = (arg << 8) if op == EXTENDED_ARG else 0
        else:
            arg = None
            extended_arg = 0  # +
        yield (i, op, arg)

作者:txfly
链接:https://www.jianshu.com/p/971141201105
来源:简书

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×