簡體   English   中英

安裝 sklearn 時 Pip 掛起並出錯

[英]Pip hangs and errors out when installing sklearn

我剛買了一台新的 M1 Max MacBook Pro,我正在嘗試為它安裝一些基本的 Python 庫。 Pandas 安裝得很好,但 sklearn 掛起非常糟糕,然后給出了一個巨大的錯誤。

我試過的: pip3 install sklearnpip install sklearn
錯誤消息長得令人難以置信。 這是最后一個看似可解析的部分:

/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:1858: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
        NOT AVAILABLE
  
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 492, in <module>
          setup_package()
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 488, in setup_package
          setup(**metadata)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
          config = configuration()
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 395, in configuration
          raise NotFoundError(msg)
      numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.

      ----------------------------------------
      ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py'"'"'; __file__='"'"'/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-record-_r3hwab1/install-record.txt --single-version-externally-managed --prefix /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay --compile --install-headers /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay/include/python3.10/scipy Check the logs for full command output.
      ----------------------------------------
    WARNING: Discarding https://files.pythonhosted.org/packages/62/7c/596ff7b32f655f379d3abdfa82607e5cb3b70f46baad4604706511cfeb85/scikit-learn-1.0.1.tar.gz#sha256=ac2ca9dbb754d61cfe1c83ba8483498ef951d29b93ec09d6f002847f210a99da (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.7). Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-standalone-pip-ij4zyayw/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.
      Using cached scikit-learn-1.0.tar.gz (7.8 MB)
      Installing build dependencies ... /

正如您在底部看到的,它試圖繼續但沒有成功。

通過使用pip install sci-kitlearn而不是sklearn 對不起,可以發誓這是sklearn

我在python 3.10+ 和 3.9+版本上面臨同樣的問題

然后我切換 python 版本3.8+並且它工作正常

如果您使用 conda 那么您可以簡單地創建一個新環境

conda create -n yourenvname python=3.8

然后激活你的新環境

conda actiavate yourenvname 

然后安裝sklearn:

pip install sci-kitlearn

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM