functools是Python 3.9自带的库,但在Python 3.7中需要安装。现有代码来自3.7.12。现在它无需 functools 即可运行,但使用 pip 安装时会报告:
Collecting functools
Using cached functools-0.5.tar.gz (4.9 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: functools
Building wheel for functools (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [57 lines of output]
src/compose.c:96:6: error: no member named 'ob_type' in 'struct compose'
co->ob_type->tp_free(co);
***********A long list of error descriptions in the middle******************
12 warnings and 3 errors generated.
error: command '/usr/bin/gcc' 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 functools
Running setup.py clean for functools
Failed to build functools
ERROR: Could not build wheels for functools, which is required to install pyproject.toml-based projects
我在 Linux 和 MACOS 中都遇到此错误。
有人可以帮我解决这个问题吗?
我在 MacOS 中尝试,然后在 Linux 中尝试,但得到相同的错误。并查遍了整个网络,仍然没有找到线索。感觉环境好像少了点什么。
functools 是 Python 3.7 附带的一个库。但我需要的功能不是。我会关闭这个。