Tan*_*010 29 python beautifulsoup
我按照所有步骤安装 Beautiful Soup,但仍然出现此错误:
\n\n\nAttributeError:模块“collections”没有属性“Callable”
\n

我正在使用Python\xc2\xa03.10。
\nali*_*afi 54
collections.Callable已移至collections.abc.Callablepython 3.10+ 中。collections一个巧妙的解决方案是在导入问题库之前将引用添加回。
import collections
collections.Callable = collections.abc.Callable
from bs4 import BeautifulSoup # for example
Run Code Online (Sandbox Code Playgroud)
小智 26
这个解决方案对我有用:
Python310\Lib\site-packages\pyreadline文件浏览器中。py3k_compat.py在文本编辑器中打开。isinstance(x, collections.Callable)return isinstance(x, collections.abc.Callable)。