错误:无法为 aiohttp 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

Ant*_*kat 25 python linux pip python-3.x aiohttp

Python版本:3.11

通过安装应用程序的依赖项pip install -r requirements.txt会出现以下错误:

socket.c -o build/temp.linux-armv8l-cpython-311/aiohttp/_websocket.o
aiohttp/_websocket.c:198:12: fatal error: 'longintrepr.h' file not found
#include "longintrepr.h"                                   
          ^~~~~~~                        1 error generated.
error: command '/data/data/com.termux/files/usr/bin/arm-linux-androideabi-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 aiohttp
Failed to build aiohttp
ERROR: Could not build wheels for aiohttp, which is required to install
pyproject.toml-based projects
Run Code Online (Sandbox Code Playgroud)

此错误特定于 Python3.11版本。在 Python 上,3.10.6版本安装顺利。

相关问题:yarl/_quoting.c:196:12: fatal error: 'longintrepr.h' file not found - 1 error generated

小智 24

aiohttp 对 python 3.11/3.12 的支持仍处于测试阶段,如果您想使用,请将 aiohttp 版本升级到 3.9.0b0

aiohttp==3.9.0b0
Run Code Online (Sandbox Code Playgroud)

参考: https: //github.com/aio-libs/aiohttp/issues/7675

  • 我可以使用 python 3.11.6 构建它。无法使用 3.12 构建,所以我认为这只会影响 3.12。 (3认同)

Ant*_*kat 20

此错误的解决方案:需要更新requirements.txt

Python 模块的不工作版本3.11

aiohttp==3.8.1
yarl==1.4.2
frozenlist==1.3.0
Run Code Online (Sandbox Code Playgroud)

工作版本:

aiohttp==3.8.2
yarl==1.8.1
frozenlist==1.3.1
Run Code Online (Sandbox Code Playgroud)

已修复的相应问题的链接:


小智 5

如果您像我一样在将 aiohttp 版本降级到 3.8.1 时遇到一些问题,您可以采用其他方法。

对我来说效果很好。


Hir*_*age 5

在 Windows 终端上运行,

pip install aiohttp==3.9.0b0
Run Code Online (Sandbox Code Playgroud)