You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Osintgram时遇collections.Callable缺失的AttributeError错误求助

解决Osintgram运行时的AttributeError: module 'collections' has no attribute 'Callable'报错

问题原因

Python 3.10及以上版本中,collections.Callable 已被迁移至 collections.abc.Callable,但你当前使用的 pyreadline 版本未适配这一变更,导致初始化时触发属性错误。

解决办法

方法1:替换为适配新版本Python的pyreadline3

这是最推荐的方案,无需修改代码:

  • 卸载旧版pyreadline:
    pip uninstall pyreadline
    
  • 安装pyreadline3:
    pip install pyreadline3
    

方法2:手动修改pyreadline的兼容文件

找到报错路径中的 py3k_compat.py 文件(路径:C:\Users\Thomas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\pyreadline\py3k_compat.py),编辑第8行:

  • 将原代码:
    return isinstance(x, collections.Callable)
    
    修改为:
    return isinstance(x, collections.abc.Callable)
    
  • 若要兼容多版本Python,可改成:
    try:
        return isinstance(x, collections.Callable)
    except AttributeError:
        return isinstance(x, collections.abc.Callable)
    

方法3:降级Python版本(不推荐)

将Python版本降级至3.9或更低,该版本仍保留collections.Callable,可直接适配旧版pyreadline。

内容的提问来源于stack exchange,提问作者Aaron Thomas Cherian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 10:55:29