我正在尝试导入和使用docx模块,但它给了我以下错误:
>>> from docx import Document
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".\docx\__init__.py", line 3, in <module>
from docx.api import Document # noqa
File ".\docx\api.py", line 14, in <module>
from docx.package import Package
File ".\docx\package.py", line 9, in <module>
from docx.opc.package import OpcPackage
File ".\docx\opc\package.py", line 9, in <module>
from docx.opc.part import PartFactory
File ".\docx\opc\part.py", line 12, in <module>
from .oxml import serialize_part_xml
File ".\docx\opc\oxml.py", line 12, in <module>
from lxml import etree
ImportError: DLL load failed while importing etree: The parameter is incorrect.
我不确定问题出在哪里,因为它以前工作正常,但是突然开始出现此错误。我尝试卸载并重新安装lxml,但没有任何改变。然后,我卸载并重新安装了docx,它改为显示此错误(非常相似):
from docx import Document
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".\docx.py", line 17, in <module>
from lxml import etree
ImportError: DLL load failed while importing etree: The parameter is incorrect.
如果我尝试'pip show lxml',这就是结果:
C:\Users\Radha Muthuswamy>pip show lxml
Name: lxml
Version: 4.5.2
Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
Home-page: https://lxml.de/
Author: lxml dev team
Author-email: lxml-dev@lxml.de
License: BSD
Location: c:\users\radha muthuswamy\appdata\local\programs\python\python38-32\lib\site-packages
Requires:
Required-by: docx
我需要此软件尽快运行,因此,请提供任何帮助,谢谢:)