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

如何用pip安装GitHub指定SHA版本的Python包?编译报错求助

解决pip安装指定GitHub commit版urllib3的编译报错

报错原因

这个错误是因为你要安装的urllib3版本采用pyproject.toml管理项目依赖,pip需要先构建wheel包才能完成安装,但你的环境缺少构建wheel所需的基础编译工具或依赖组件。

解决步骤

  • 安装系统编译工具链
    根据你的操作系统执行对应操作:

    • Windows:安装Visual Studio构建工具,勾选“C++构建工具”组件。
    • macOS:在终端执行 xcode-select --install 安装Xcode命令行工具。
    • Debian/Ubuntu系Linux:执行 sudo apt-get update && sudo apt-get install build-essential python3-dev。
    • RHEL/CentOS系Linux:执行 sudo yum groupinstall "Development Tools" && sudo yum install python3-devel。
  • 更新pip、setuptools和wheel到最新版
    旧版本的工具可能不兼容pyproject.toml规范,先升级:

    pip3 install --upgrade pip setuptools wheel --user
    
  • 重新执行安装命令
    完成上述步骤后,再次运行你的安装命令:

    pip3 install git+https://github.com/hramezani/urllib3.git@6a77aa11fe849f988c07b53e1d31d082de07a2e3 --user
    
  • 备选方案:跳过wheel构建直接装源码
    如果还是报错,强制pip直接安装源码包:

    pip3 install git+https://github.com/hramezani/urllib3.git@6a77aa11fe849f988c07b53e1d31d082de07a2e3 --user --no-binary :all:
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 11:06:47