You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python安装selectorlib包时遇lxml编译失败问题求助

安装selectorlib包时遭遇lxml编译失败问题

我尝试安装selectorlib包,操作如下:

  • 导入语句:import selectorlib
  • 终端安装命令:pip install selectorlib

但安装过程中出现错误,核心报错信息如下:

Building wheel for lxml (setup.py)
error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
[115 lines of output]
...
error: command '/usr/bin/clang' failed with exit code 1
[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, cssselect, Click, parsel, selectorlib
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
...
[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.

我已尝试以下解决方法,但问题仍存在:

  • 使用不同Python解释器(3.9.6、3.10.9、3.11.1)
  • 在VS Code和PyCharm CE中分别尝试安装
  • 尝试安装selectorlib最近3个版本

内容的提问来源于stack exchange,提问作者pythonPlant

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 02:40:27