不能成功配置sklearn

Collecting scikit-learn
  Using cached scikit-learn-1.2.2.tar.gz (7.3 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      Ignoring numpy: markers 'python_version == "3.10" and platform_system == "Windows" and platform_python_implementation != "PyPy"' don't match your environment
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0504DBC8>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/
      Collecting setuptools
        Using cached setuptools-67.8.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
      Collecting Cython>=0.29.24
        Using cached Cython-0.29.35-py2.py3-none-any.whl (988 kB)
      Collecting oldest-supported-numpy
        Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
      Collecting scipy>=1.3.2
        Using cached scipy-1.10.1.tar.gz (42.4 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Installing backend dependencies: started
        Installing backend dependencies: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Preparing metadata (pyproject.toml) did not run successfully.
        exit code: 1

        [12 lines of output]
        + meson setup --prefix=c:\python\python38-32 C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c\.mesonpy-3pwxxm7h\build --native-file=C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
        The Meson build system
        Version: 1.1.1
        Source dir: C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c
        Build dir: C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c\.mesonpy-3pwxxm7h\build
        Build type: native build
        Project name: SciPy
        Project version: 1.10.1

        ..\..\meson.build:1:0: ERROR: Compiler cl can not compile programs.

        A full log can be found at C:\Users\啊\AppData\Local\Temp\pip-install-9zbse_kk\scipy_54c4098e4e34424c9352b71b088ca55c\.mesonpy-3pwxxm7h\build\meson-logs\meson-log.txt
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed

      Encountered error while generating package metadata.

      See above for output.

      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

受不了,我还特地配置了c的环境变量,还是不能成功配置sklearn

这个错误是在安装sklearn时错写了错误。 numpy: markers 'python_version == "3.10" and platform_system == "Windows" and platform_python_implementation != "PyPy"' don't match your environmen 这里提示了numpy 当前的版本和python3.10不匹配。
解决方法是,可以安装较低版本的numpy看看,比如,pip install numpy==1.19.2 或其他版本

我觉得应该一步一步的排查,先手动安装它的每一个依赖,根据提示查看依赖,然后在安装这个库试试

这个错误看起来是在安装 scikit-learn 时出现了问题,因为它的依赖项 scipy 无法安装。scipy 安装失败的原因可能是由于缺少一些构建依赖项,或者是由于本地环境配置不正确导致的。

以下是一些可能有用的步骤:

确保你的 Python 版本与 scikit-learn 和 scipy 的要求兼容。在 scikit-learn 的文档中可以查找它所需的 Python 和 numpy 版本的信息。

尝试升级 pip 工具到最新版本,可以使用以下命令:

Copy
pip install --upgrade pip

```

确保已安装一些必要的构建工具,如 C 编译器、Fortran 编译器等。这些工具在不同的操作系统上可能有所不同,可以查看 scikit-learn 和 scipy 的文档来了解更多信息。

尝试使用 Anaconda 或 Miniconda 等 Python 发行版,它们可以提供一些预编译的依赖项,可以避免安装构建工具的问题。

如果你使用的是 Windows 操作系统,可能需要安装 Microsoft Visual C++ Build Tools 或 Microsoft Visual Studio,这些工具提供了 Windows 平台上的 C/C++ 编译器。

如果你使用的是 Linux 或 macOS,可能需要安装一些系统软件包,例如 gcc、gfortran 和 libatlas-base-dev 等。这些软件包可以使用你的系统包管理器来安装。

如果你在安装 scipy 时遇到了特定的错误消息,可以通过搜索错误消息来找到解决方案,或者查看 scipy 的文档和社区支持来获取更多帮助。

成功了,换了个python-3.9.13-amd64版本