我的问题与this thread非常相似,但是解决方案无法解决我的问题。我不断收到此错误。
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.
在我最初安装的python-pptx上,使用了:
pip install python-pptx
这不起作用,因为OP在他的职位上表示正在为他工作。我已使用pip卸载并重新安装,并得到相同的错误。我还尝试重新安装并获得:
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将更新
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 /
但是我仍然得到一个错误。 当我运行pip install lxml时,我得到:
Requirement already satisfied: lxml in c:\program files\anaconda3\lib\site-packages (4.4.2)
因此,我现在完全不知道该怎么做才能做。任何帮助深表感谢! TIA!
更新:我先卸载了python-pptx
,然后卸载了lxml
,然后才卸载了pip install python-pptx
,我认为它可能正在工作。
答案 0 :(得分:-2)
通过pip install将lxml升级到最新版本--upgrade lxml对我有用。