#pip install python-pptx
from pptx import Presentation
def creat_ppt():
#创建ppt对象
ppt = Presentation()
#添加幻灯片
ppt.slides.add_slide(ppt.slide_layouts[0])
#保存
ppt.save('./creat_ppts/01_ppt.pptx')
if __name__ == '__main__':
creat_ppt()
Traceback (most recent call last):
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\compat\__init__.py", line 10, in <module>
Container = collections.abc.Container
^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'abc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "f:\vscode\auto_ppt\01creat_ppt.py", line 2, in <module>
from pptx import Presentation
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\__init__.py", line 14, in <module>
from pptx.api import Presentation # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\api.py", line 15, in <module>
from .package import Package
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\package.py", line 6, in <module>
from pptx.opc.package import OpcPackage
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\opc\package.py", line 11, in <module>
from pptx.compat import is_string, Mapping
File "D:\Users\W9020478\AppData\Local\Programs\Python\Python311\Lib\site-packages\pptx\compat\__init__.py", line 14, in <module>
Container = collections.Container
^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Container'
这是什么错误