簡體   English   中英

無法在 Mac M1 上安裝 pandas 和其他 python 庫

[英]Can't install pandas and other python libraries on Mac M1

拳頭我在新的 Mac book M1 上安裝 numpy 庫時遇到很多問題。 (主要使用 pep517),最后我使用python3 -m pip install --no-binary:all: --no-use-pep517 numpy==1.20rc1命令安裝它,現在,當我嘗試安裝 pandas (使用 pip3)圖書館,我面臨一長串錯誤:

Installing build dependencies ... error
ERROR: Command errored out with exit status 1: 
   command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix  .....)
      File "/private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-pxjl8ilr/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
        assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
    AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_11_0_universal2')
  
    ########### EXT COMPILER OPTIMIZATION ###########
    Platform      :
      Architecture: unsupported
      Compiler    : gcc
  
    CPU baseline  :
      Requested   : optimization disabled
      Enabled     : none
      Flags       : none
      Extra checks: none
      Requested   : optimization disabled
  
    CPU dispatch  :
      Enabled     : none
      Generated   : none
    CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_ext.py
  
    ########### CLIB COMPILER OPTIMIZATION ###########
    Platform      :
      Architecture: unsupported
      Compiler    : gcc
  
    CPU baseline  :
      Requested   : optimization disabled
      Enabled     : none
      Flags       : none
      Extra checks: none
      Requested   : optimization disabled
  
    CPU dispatch  :
      Enabled     : none
      Generated   : none
    CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_clib.py
    ----------------------------------------
    ERROR: Failed building wheel for numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/78/e4/a935f1701fac697c6c5458f86968bec5d2b4cb66e7f738225216ebaa20b4/pandas-1.2.2.tar.gz#sha256=14ed84b463e9b84c8ff9308a79b04bf591ae3122a376ee0f62c68a1bd917a773 (from https://pypi.org/simple/pandas/) (requires-python:>=3.7.1). Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-77vprpke/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
  Using cached pandas-1.2.1.tar.gz (5.5 MB)
  Installing build dependencies ... -^canceled
ERROR: Operation cancelled by user

如何安裝 pandas? 其他庫,如 scipy 也面臨類似的錯誤(關於 clang 的一些錯誤。

我使用自制軟件安裝 python 和 numpy,但在嘗試使用 Z62AD1C2A46C5298DDCBA3 安裝 pandas 時收到相同的錯誤消息。

我可以讓 pandas 從源代碼安裝它( https://github.com/pandas-dev/pandas/releases

解壓縮下載的文件並導航到根文件夾。

  • pip3 安裝 cython
  • python3 setup.py 安裝

我使用arch x86_64 pip3 install <package>解決了這個問題 顯然 arm64 的 M1 還不支持一些 python 庫!

我按照此鏈接上的步驟解決了這個問題: https://laict.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9

允許我通過 homebrew 和 pyenv install python 3.8.6 安裝 pyenv。 一旦安裝了它,我就能夠 pip 安裝我需要的一切(包括 numpy 和 pandas 我見過很多其他人有問題)。 但是,我之前嘗試使用 3.7.10 完成所有這些操作,但遇到了一些與您類似的問題。

不幸的是,我仍然不確定如何在 mac M1 上安裝 python3.7。

暫無
暫無

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

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