失败:属性错误:模块“集合”没有属性“容器”

Vla*_*bit 16 python powerpoint python-pptx

我尝试启动python-pptx,但出现错误:

AttributeError: module 'collections' has no attribute 'Container'
in File "...\lib\site-packages\pptx_init_.py", line 14 
Run Code Online (Sandbox Code Playgroud)

使用Python 3.10、python-pptx (0.6.21)、lxmx (4.6.3)。

小智 31

这是本期中讨论的 Python 3.10 的一个已知问题。解决方法是在collections导入 . 例如:collections.abcpptx

import collections 
import collections.abc
from pptx import Presentation
Run Code Online (Sandbox Code Playgroud)

这应该可以解决此错误