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

执行`pip install langchain`命令后出现wheel编译失败错误求助

解决pip安装langchain时的wheel编译失败问题

执行pip install langchain时遇到以下错误:

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for yarl
Failed to build aiohttp frozenlist multidict yarl
ERROR: Could not build wheels for aiohttp, frozenlist, multidict, yarl, which is required to install pyproject.toml-based projects

这类问题通常因缺少Python C扩展编译依赖,或pip/setuptools版本过低导致,以下是可行解决办法:

  • 升级pip、setuptools和wheel到最新版本:

    pip install --upgrade pip setuptools wheel
    

    升级后重新执行pip install langchain,新版本工具对pyproject.toml支持更完善,能优化编译流程。

  • 安装系统级编译依赖:

    • Windows:安装Microsoft Visual C++ Build Tools,安装时务必勾选“C++构建工具”组件,这是编译Python扩展包的必需环境。
    • Linux(Debian/Ubuntu):执行命令安装gcc和Python开发包:
      sudo apt-get update && sudo apt-get install gcc python3-dev
      
    • Linux(RHEL/CentOS):执行命令:
      sudo yum install gcc python3-devel
      
    • macOS:安装Xcode命令行工具:
      xcode-select --install
      
  • 手动安装预编译wheel包:
    若编译仍失败,可直接下载对应系统和Python版本的预编译wheel文件(针对aiohttp、multidict、yarl、frozenlist),先安装这些wheel再安装langchain:

    pip install aiohttp-xxx.whl multidict-xxx.whl yarl-xxx.whl frozenlist-xxx.whl
    pip install langchain
    
  • 使用conda环境安装:
    若用conda管理环境,可通过conda-forge源安装,conda会自动处理依赖编译问题:

    conda install -c conda-forge langchain
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 23:55:58