每日一坑 pyinstaller 将.py生成.exe 报错 “IndexError: tuple index out of range”

使用pyinstaller将Python脚本打包为exe时遇到'IndexError: tuple index out of range'错误。问题源于pyinstaller官方3.2.1版本不支持Python 3.6。解决方案是下载pyinstaller的GitHub开发版源码,替换现有库文件,使其支持Python 3.6。使用pip安装pyinstaller后,通过命令行进行打包,常见参数如'-F'和'-w'可用于创建独立的exe文件。

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

为了方便运营人员使用脚本,只好用pyinstaller将py打包为exe文件,用pysintaller居然报错

  File "c:\anaconda3\lib\site-packages\PyInstaller\depend\utils.py", line 226, in __scan_code_instruction_for_ctypes
    name = co.co_names[oparg]
IndexError: tuple index out of range

这里写图片描述
搜索了一番,用群众神奇的方式

找到D:\python\Python36-32\Lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py
路径根据安装目录找ÿ

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值