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

安装Python库aiohttp时multidict编译wheel失败问题求助

安装aiohttp时multidict编译失败的解决办法

问题详情

执行pip3 install aiohttp安装aiohttp库时,安装流程中断,核心错误为:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools"

完整错误日志:

C:\Users\1\AppData\Local\Programs\Python\Python312\Scripts>pip3 install aiohttp
Collecting aiohttp
  Obtaining dependency information for aiohttp from https://files.pythonhosted.org/packages/4e/13/e929a6a50288e60ade3961b294d2f5aeb251b6579e4290a5397e484d0df9/aiohttp-3.9.1-cp312-cp312-win_amd64.whl.metadata
 ...   ...
Using cached frozenlist-1.4.1-cp312-cp312-win_amd64.whl (50 kB)
Using cached yarl-1.9.4-cp312-cp312-win_amd64.whl (76 kB)
Building wheels for collected packages: multidict
  Building wheel for multidict (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for multidict (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      *********************
      * Accelerated build *
      *********************
      running bdist_wheel
 ...   ...
      running build_ext
      building 'multidict._multidict' 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 multidict
Failed to build multidict
ERROR: Could not build wheels for multidict, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: C:\Users\1\AppData\Local\Programs\Python\Python312\python.exe -m pip install --upgrade pip

已尝试pip install pyproject,无效。

解决步骤

1. 安装VC++编译工具

  • 下载并安装Microsoft Visual C++ Build Tools
  • 安装时必须勾选**"Desktop development with C++"**组件,确保包含MSVC编译器、Windows SDK等核心工具
  • 安装完成后重启终端,重新执行pip3 install aiohttp

2. 安装预编译的multidict wheel

  • 下载对应Python 3.12、win_amd64架构的multidict预编译wheel文件
  • 执行pip install [wheel文件名]安装multidict
  • 再运行pip3 install aiohttp完成安装

3. 升级pip后重试

先升级pip到最新版本:

C:\Users\1\AppData\Local\Programs\Python\Python312\python.exe -m pip install --upgrade pip

然后重新执行pip3 install aiohttp

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 05:53:49