在 Windows 中安装 lxml 的问题

问题描述 投票:0回答:0
C:\Users\home>pip install lxml
Collecting lxml
  Using cached lxml-4.9.2.tar.gz (3.7 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
  ╰─> [102 lines of output]
      Building lxml version 4.9.2.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.mingw_x86_64-cpython-310
      creating build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\builder.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\cssselect.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\doctestcompare.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\ElementInclude.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\sax.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\usedoctest.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\_elementpath.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml
      creating build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      creating build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\builder.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\clean.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\defs.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\diff.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\etree_api.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\lxml.etree.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\etree.pyx -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\objectify.pyx -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\apihelpers.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\classlookup.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\cleanup.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\debug.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\docloader.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\dtd.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\extensions.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\iterparse.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\nsclasses.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\objectpath.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\parser.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\parsertarget.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\proxy.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\public-api.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\readonlytree.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\relaxng.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\saxparser.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\schematron.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\serializer.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xinclude.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlerror.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlid.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlschema.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xpath.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xslt.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xsltext.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\rng
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
      [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
  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
  ╰─> [104 lines of output]
      Building lxml version 4.9.2.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\msys64\mingw64\lib\python3.10\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.mingw_x86_64-cpython-310
      creating build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\builder.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\cssselect.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\doctestcompare.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\ElementInclude.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\sax.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\usedoctest.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\_elementpath.py -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml
      creating build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      creating build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\builder.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\clean.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\defs.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\diff.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\html
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\etree_api.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\lxml.etree.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\etree.pyx -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\objectify.pyx -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\apihelpers.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\classlookup.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\cleanup.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\debug.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\docloader.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\dtd.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\extensions.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\iterparse.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\nsclasses.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\objectpath.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\parser.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\parsertarget.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\proxy.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\public-api.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\readonlytree.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\relaxng.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\saxparser.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\schematron.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\serializer.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xinclude.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlerror.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlid.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xmlschema.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xpath.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xslt.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\xsltext.pxi -> build\lib.mingw_x86_64-cpython-310\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.mingw_x86_64-cpython-310\lxml\includes
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\rng
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl
      creating build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.mingw_x86_64-cpython-310\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
      [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.

我想安装 lxml 和 docs,但尝试安装时出现错误

python cmd lxml documentation lib
© www.soinside.com 2019 - 2024. All rights reserved.