Python用PyInstaller打包成exe時報錯:tuple index out of range
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2645, in _scan_codeself._scan_bytecode(
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2749, in _scan_bytecode
for inst in util.iterate_instructions(module_code_object):
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 147, in iterate_instructions
yield from iterate_instructions(constant)
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py", line 139, in iterate_instructions
yield from get_instructions(code_object)
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\dis.py", line 338, in _get_instructions_bytes
argval, argrepr = _get_const_info(arg, constants)
File "C:\Users\xx\AppData\Local\Programs\Python\Python310\lib\dis.py", line 292, in _get_const_info
argval = const_list
運行環境
win10
python3.10
pycharm2021
解決方案:
[*]定位到C:\Users\hp\AppData\Local\Programs\Python\Python310\Lib\dis.py(每個人的路徑可能不同)
[*]找到_unpack_opargs(code)函數
[*]在else中加入extended_arg = 0語句
[*]如圖
文章出處: NetYea 網頁設計
頁:
[1]