我只是想在Python中安装aiohttp。 所以我只是在控制台中输入: pip install aiohttp 。 一开始安装很顺利,但最后却出现了以下错误。
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”。 但我无法解决。 请帮助我!
您的错误消息显示:
Microsoft Visual C++ 14.0 or greater is required.
因此您应该使用“Microsoft C++ Build Tools”获取它:https://visualstudio.microsoft.com/visual-cpp-build-tools/`
另请注意,aiohttp 目前支持 Python 3.8 - 3.10,但您似乎使用的是 Python 3.12。