“无法为 scikit-learn 构建轮子,这是安装基于 pyproject.toml 的项目所必需的”,

问题描述 投票:0回答:1

我正在安装 niwidgets ,在安装过程中它会抛出wheel编译错误:

** scikit-learn 的构建轮 (setup.py) ... 错误

错误:子进程退出并出现错误

python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [820 lines of output]
      /private/var/folders/t_/tkgl1f8j7y14c3d40pcymqmw0000gn/T/pip-install-oqhx_cr5/scikit-learn_1cef91db2c464800815e767404a4ca2f/setup.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        from pkg_resources import parse_version
      Partial import of sklearn during the build process.
      /private/var/folders/t_/tkgl1f8j7y14c3d40pcymqmw0000gn/T/pip-install-oqhx_cr5/scikit-learn_1cef91db2c464800815e767404a4ca2f/setup.py:242: DeprecationWarning:

      
        `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
        of the deprecation of `distutils` itself. It will be removed for
        Python >= 3.12. For older Python versions it will remain present.
        It is recommended to use `setuptools < 60.0` for those Python versions.}

注意:此错误源自子进程,可能不是 pip 的问题。

错误:scikit-learn 构建轮子失败 为 scikit-learn 运行 setup.py clean 构建 scikit-learn 失败 错误:无法为 scikit-learn 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

完整日志:https://paste-bin.xyz/8121468

python macos scikit-learn setup.py
1个回答
0
投票

部分错误消息指出:

由于

numpy.distutils

 本身已被弃用,因此自 NumPy 1.23.0 起,
distutils
已被弃用。对于 Python >= 3.12,它将被删除。对于较旧的 Python 版本,它将仍然存在。对于那些 Python 版本,建议使用
setuptools < 60.0
。}

从完整的错误日志中可以看出,您似乎正在使用 Python 3.11,这意味着您必须使用 setuptools < 60.0 as recommended in your error message.

您可以通过在您的环境中运行 pip install setuptools==59.8.0 来获取

setuptools 59.8.0

© www.soinside.com 2019 - 2024. All rights reserved.