ImportError with python-pptx

左心房为你撑大大i 提交于 2021-01-29 06:07:04

问题


I faced with problem when I installed python-pptx with conda on cleaned environment: conda install -c conda-forge python-pptx. After install was successfully finished I tried to import pptx module and got following error:

>>> import pptx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\SazonovEO\AppData\Local\Continuum\anaconda3\envs\new\lib\site-p
ackages\pptx\__init__.py", line 13, in <module>
    from pptx.api import Presentation  # noqa
  File "C:\Users\SazonovEO\AppData\Local\Continuum\anaconda3\envs\new\lib\site-p
ackages\pptx\api.py", line 17, in <module>
    from .package import Package
  File "C:\Users\SazonovEO\AppData\Local\Continuum\anaconda3\envs\new\lib\site-p
ackages\pptx\package.py", line 13, in <module>
    from .opc.package import OpcPackage
  File "C:\Users\SazonovEO\AppData\Local\Continuum\anaconda3\envs\new\lib\site-p
ackages\pptx\opc\package.py", line 13, in <module>
    from .oxml import CT_Relationships, serialize_part_xml
  File "C:\Users\SazonovEO\AppData\Local\Continuum\anaconda3\envs\new\lib\site-p
ackages\pptx\opc\oxml.py", line 12, in <module>
    from lxml import etree
ImportError: DLL load failed: Не найден указанный модуль.

But if I installed this library (python-pptx) with pip like this (also into new cleaned environment):

pip install python-pptx

this works. I have following versions: python version - 3.7.1, python-pptx-0.6.17, lxml-4.3.0.

Do you have any ideas about this issue?


回答1:


Reinstallation lxml from pkgs/main channel from anaconda repo allow workaround issue:

conda install lxml

The following packages will be UPDATED:

libxml2 conda-forge::libxml2-2.9.8-h9ce36c8_1~ --> pkgs/main::libxm l2-2.9.9-h464c3ec_0 libxslt
conda-forge::libxslt-1.1.32-heafd4d3_~ --> pkgs/main::libxs lt-1.1.33-h579f668_0

The following packages will be SUPERSEDED by a higher-priority channel: ... lxml
conda-forge::lxml-4.3.2-py37heafd4d3_0 --> pkgs/main::lxml- 4.3.2-py37h1350720_0 ...



来源:https://stackoverflow.com/questions/55210888/importerror-with-python-pptx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!