简体   繁体   English

安装 python-docx 时出现错误,我该如何解决?

[英]I get an error while installing python-docx how can i solve this?

C:\Users\Mateo>pip install python-docx
Collecting python-docx
  Using cached python_docx-0.8.11-py3-none-any.whl
Collecting lxml>=2.3.2
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
      creating build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\lxml
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Users\Mateo\AppData\Local\Programs\Python\Python311\include -IC:\Users\Mateo\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-311\Release\src\lxml\etree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:\Users\Mateo\AppData\Local\Temp\pip-install-e21y1uta\lxml_6a1c02a358e44a829f28dd12b951e3ab\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\Mateo
      creating Users\Mateo\AppData
      creating Users\Mateo\AppData\Local
      creating Users\Mateo\AppData\Local\Temp
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /TcC:\Users\Mateo\AppData\Local\Temp\xmlXPathInit3lxm04ns.c /FoUsers\Mateo\AppData\Local\Temp\xmlXPathInit3lxm04ns.obj
      xmlXPathInit3lxm04ns.c
      C:\Users\Mateo\AppData\Local\Temp\xmlXPathInit3lxm04ns.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, python-docx
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Users\Mateo\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-311\lxml
      creating build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-311\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-311\lxml\html
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-311\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-311\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-311\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-311\lxml\includes
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-311\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\src
      creating build\temp.win-amd64-cpython-311\Release\src\lxml
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Users\Mateo\AppData\Local\Programs\Python\Python311\include -IC:\Users\Mateo\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-311\Release\src\lxml\etree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:\Users\Mateo\AppData\Local\Temp\pip-install-e21y1uta\lxml_6a1c02a358e44a829f28dd12b951e3ab\src\lxml\includes/etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /TcC:\Users\Mateo\AppData\Local\Temp\xmlXPathInit_6as6yae.c /FoUsers\Mateo\AppData\Local\Temp\xmlXPathInit_6as6yae.obj
      xmlXPathInit_6as6yae.c
      C:\Users\Mateo\AppData\Local\Temp\xmlXPathInit_6as6yae.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lxml

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I want to download python-docx and i am not so familiar with python libraries, pip and installing this way.我想下载 python-docx,但我不太熟悉 python 库、pip 和这种安装方式。 If I try this I get some errors.如果我尝试这样做,我会得到一些错误。

First it said that it couldn't build a wheel for lxml and that I needed microsoft visual C++ 2014 so I downloaded microsoft visual studio and installed the C++ build tools.首先它说它不能为 lxml 构建轮子并且我需要 microsoft visual C++ 2014 所以我下载了 microsoft visual studio 并安装了 C++ 构建工具。 Than that error dissapeared but now it sais it can't build the wheel and "Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?"比那个错误消失了但现在它说它无法构建轮子并且“无法在库 libxml2 中找到 function xmlCheckVersion。是否安装了 libxml2?” I tried downloading the zip file libxml2 and putting it where python is stored butnothing works.我尝试下载 zip 文件 libxml2 并将其放在存储 python 的位置,但没有任何效果。

Okay after an hour of searching:) I found something that works.好的,经过一个小时的搜索:) 我找到了一些有用的东西。 So for the beginners like me I'll explain it very simple.所以对于像我这样的初学者,我会解释得很简单。

  1. First download the right lxml file here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml首先在这里下载正确的lxml文件: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
  2. Then type this in cmd: pip install C:\path\to\downloaded\file\lxml‑4.5.2‑cp39‑cp39‑win32.whl but ofc change the path to where you stored the file you just downloaded.然后在 cmd 中键入: pip install C:\path\to\downloaded\file\lxml‑4.5.2‑cp39‑cp39‑win32.whl 但 ofc 将路径更改为存储刚刚下载的文件的位置。 Now you have lxml installed and the error should be gone.现在你已经安装了 lxml,错误应该消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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