鱼C论坛

 找回密码
 立即注册
查看: 1882|回复: 2

[已解决]使用pip 安装lxml 失败,尝试过更新pip版本

[复制链接]
发表于 2022-11-22 11:01:38 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
PS D:\QQ\QQ信息记录\752232503\FileRecv\MobileFile> pip install lxml
Collecting lxml
  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
  ╰─> [74 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
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https:visualstudio.microsoft.com/visual-cpp-build-tools/
      [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
  ╰─> [76 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:\Users\M&W\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
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https/visualstudio.microsoft.com/visual-cpp-build-tools/
      [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.
最佳答案
2022-11-22 20:51:45
你回退装3.10版的或者3.9版本的应该就OK了,
如果确实想用3.11,就用vs_buildtools工具安装一个msvc和windows10/11sdk环境就好了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2022-11-22 20:02:37 | 显示全部楼层
1. 卸载Python3.11 ,选择用 Python 3.7 或 3.8 或 3.9  。

2. 若非要用 Python3.11,那就做好解决各种Bug的准备。 其次,对于这里这个报错,尝试 根据它的提示安装好:Microsoft Visual C++ 14.0 or greater
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-11-22 20:51:45 | 显示全部楼层    本楼为最佳答案   
你回退装3.10版的或者3.9版本的应该就OK了,
如果确实想用3.11,就用vs_buildtools工具安装一个msvc和windows10/11sdk环境就好了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-15 17:20

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表