簡體   English   中英

無法在 windwos 11 上安裝 lxml 包

[英]Can;t install lxml package on windwos 11

"PS D:\Complete-Python-3-Bootcamp-master\12-Advanced Python Modules\puzzle_unzip> pip install lxml
Collecting lxml
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Installing collected packages: lxml
  DEPRECATION: lxml is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  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
  ╰─> [96 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Users\lohar\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\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes -IC:\Users\lohar\AppData\Local\Programs\Python\Python311\include -IC:\Users\lohar\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.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\lohar\AppData\Local\Temp\pip-install-v8_cypj7\lxml_b1e7951ab83046e384fffcd4610d3736\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\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\lohar
      creating Users\lohar\AppData
      creating Users\lohar\AppData\Local
      creating Users\lohar\AppData\Local\Temp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcC:\Users\lohar\AppData\Local\Temp\xmlXPathInituop21067.c /FoUsers\lohar\AppData\Local\Temp\xmlXPathInituop21067.obj
      xmlXPathInituop21067.c
      C:\Users\lohar\AppData\Local\Temp\xmlXPathInituop21067.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\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\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.
PS D:\Complete-Python-3-Bootcamp-master\12-Advanced Python Modules\puzzle_unzip> "
  • 我正在嘗試通過 pip install lxml 安裝 lxml 庫。
  • 我還安裝了 vs 構建工具 2022。
  • 在那之后我堅持這個錯誤我嘗試了很多東西但是他們不工作
  • 我嘗試手動安裝軟件包的事情。
  • 多種互聯網解決方案

我期待在 W11 機器上安裝 lxml 的解決方案。我還使用 vs 代碼和 pycharm python 版本 3.11 和 pip 版本 22.3.1

Python lxml模塊是兩個 C 庫的語言綁定/包裝器。

對於 Windows,他們提供包含這些庫的二進制構建。 否則,在 Windows 上安裝和運行它會很痛苦。 因為它是 Windows。 “開發人員,開發人員,開發人員”..(正如 lxml 開發人員所說:“該平台的用戶通常無法自己構建 lxml”)

通常你應該在通過 pip 安裝時獲得二進制分發版,但在這種情況下你不需要。

  1. 嘗試固定舊版本,也許二進制文件可用於它:

     pip install lxml==4.9.0
  2. 嘗試從此處下載 Christoph Gohlke 提供的 lxml 二進制分發版。

    您也可以通過 pip 安裝 wheel 文件。

資料來源:

  1. 二進制構建在哪里?
  2. 源代碼基於 MS Windows

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM