关于python:collections-has-no-attribute-MutableMapping

71次阅读

共计 451 个字符,预计需要花费 2 分钟才能阅读完成。

AttributeError: module ‘collections’ has no attribute ‘MutableMapping’

那起因是什么呢?

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

也就是说,from collections import Mapping, MutableMapping 这种用法在 python3.10 上曾经被移除了

从 python3.3 开始,就应该应用 from collections.abc import MutableMapping 代替 from collections import Mapping, MutableMapping

在 python3.10 上,彻底移除了 from collections import Mapping, MutableMapping 这种用法

正文完
 0