简体   繁体   中英

Error when Import pptx "ImportError: DLL load failed: The specified procedure could not be found."

I have a very similar issue to this thread however the solution is not fixing my issue. I keep getting this error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Anaconda3\lib\site-packages\pptx\__init__.py", line 14, in <module>
    from pptx.api import Presentation  # noqa
  File "C:\Program Files\Anaconda3\lib\site-packages\pptx\api.py", line 15, in <module>
    from .package import Package
  File "C:\Program Files\Anaconda3\lib\site-packages\pptx\package.py", line 11, in <module>
    from .opc.package import OpcPackage
  File "C:\Program Files\Anaconda3\lib\site-packages\pptx\opc\package.py", line 13, in <module>
    from .oxml import CT_Relationships, serialize_part_xml
  File "C:\Program Files\Anaconda3\lib\site-packages\pptx\opc\oxml.py", line 12, in <module>
    from lxml import etree
ImportError: DLL load failed: The specified procedure could not be found.

On my initial install of python-pptx I used:

pip install python-pptx

which is not working as the OP said was working for him in his post. I have used pip uninstall and reinstalled, and get the same error. I also tried to just install again and get:

Looking in indexes: website name was here
Requirement already satisfied: python-pptx in c:\program files\anaconda3\lib\site-packages (0.6.18)
Requirement already satisfied: lxml>=3.1.0 in c:\program files\anaconda3\lib\site-packages (from python-pptx) (4.4.2)
Requirement already satisfied: Pillow>=3.3.2 in c:\program files\anaconda3\lib\site-packages (from python-pptx) (6.2.1)
Requirement already satisfied: XlsxWriter>=0.5.7 in c:\program files\anaconda3\lib\site-packages (from python-pptx) (1.1.2)

conda install lxml will update

ca-certificates:        2018.03.07-0           https://repo.anaconda.com/pkgs/main --> 2019.11.27-0           /
    certifi:                2018.11.29-py37_0      https://repo.anaconda.com/pkgs/main --> 2019.11.28-py37_0      /
    conda:                  4.5.12-py37_0          https://repo.anaconda.com/pkgs/main --> 4.7.12-py37_0          /
    libxml2:                2.9.8-hadb2253_1       https://repo.anaconda.com/pkgs/main --> 2.9.9-h464c3ec_0       /
    libxslt:                1.1.32-hf6f1972_0      https://repo.anaconda.com/pkgs/main --> 1.1.33-h579f668_0      /
    lxml:                   4.2.5-py37hef2cd61_0   https://repo.anaconda.com/pkgs/main --> 4.4.2-py37h1350720_0   /
    openssl:                1.1.1a-he774522_0      https://repo.anaconda.com/pkgs/main --> 1.1.1d-he774522_3      /
    qt:                     5.9.7-vc14h73c81de_0   https://repo.anaconda.com/pkgs/main [vc14] --> 5.9.7-vc14h73c81de_0   /
    vc:                     14.1-h0510ff6_4        https://repo.anaconda.com/pkgs/main --> 14.1-h0510ff6_4        /
    vs2015_runtime:         14.15.26706-h3a45250_0 https://repo.anaconda.com/pkgs/main --> 14.16.27012-hf0eaf9b_0 /

but I still get an error. When I run pip install lxml I get:

Requirement already satisfied: lxml in c:\program files\anaconda3\lib\site-packages (4.4.2)

So I'm completely lost right now about what to do to get this to work. Any help is much appreciated! TIA!

UPDATE: I uninstalled python-pptx and then lxml and then just did pip install python-pptx and I think it may be working.

通过 pip install --upgrade lxml 将 lxml 升级到最新版本对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM