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

问题描述 投票:0回答:2

我尝试启动

python-pptx
,但出现错误:

AttributeError: module 'collections' has no attribute 'Container'
in File "...\lib\site-packages\pptx_init_.py", line 14 

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

python powerpoint python-pptx
2个回答
30
投票

这是 Python 3.10 的一个已知问题,如本 issue 中所述。解决方法是导入两个模块

collections
和 导入之前
collections.abc
pptx
。例如:

import collections 
import collections.abc
from pptx import Presentation

这应该可以解决此错误


0
投票

我将python 3.10更改为python 3.9,问题解决了。

© www.soinside.com 2019 - 2024. All rights reserved.