无法在 Pycharm 和 Apple m1 上通过 cli 安装包 scikit-learn

问题描述

当它开始时,它写道:

Using cached scikit-learn-0.23.0.tar.gz (7.2 MB)
Installing build dependencies ... -

然后就挂了一个小时,写了这个日志(不能完全包含日志)

ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
ERROR: Command errored out with exit status 1:

ERROR: Failed cleaning build dir for scipy
Failed to build numpy scipy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly

atlas_info:
      libraries lapack_atlas not found in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib
      libraries f77blas,cblas,atlas not found in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries f77blas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries f77blas,atlas not found in /usr/lib
      libraries lapack_atlas not found in /opt/local/lib
      libraries f77blas,atlas not found in /opt/local/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib
      libraries tatlas,tatlas not found in /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries tatlas,tatlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/lib
      libraries tatlas,tatlas not found in /usr/lib
      libraries lapack_atlas not found in /opt/local/lib
      libraries tatlas,tatlas not found in /opt/local/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

File "/private/var/folders/xg/45g_0kp96gj_11cftvnq919r0000gn/T/pip-install-1jwea3es/scikit-learn_dc15d18c3d214b0682eae44ae71e0d21/sklearn/_build_utils/__init__.py",line 35,in _check_cython_version
        raise ModuleNotFoundError(message)
    ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.

我还通过 brew 安装了 scipy,但没有帮助。

解决方法

我从官方网站安装了 anaconda 并获得了安装 sklearn 的能力。