为了方便运营人员使用脚本,只好用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
路径根据安装目录找,上面是我的安装目录
打开modulegraph.py将大约2731附近将

使用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文件。
最低0.47元/天 解锁文章
8931

被折叠的 条评论
为什么被折叠?



