无法在 Apple M1 上安装 python lib 'coremltools' - Python 3.9 版

Posted

技术标签:

【中文标题】无法在 Apple M1 上安装 python lib \'coremltools\' - Python 3.9 版【英文标题】:Can't install python lib 'coremltools' on Apple M1 - Python version 3.9无法在 Apple M1 上安装 python lib 'coremltools' - Python 3.9 版 【发布时间】:2021-09-03 16:39:46 【问题描述】:

我正在尝试在 macbook air m1 上安装 coremltools。

直到一切都好。

Defaulting to user installation because normal site-packages is not writeable
Collecting coremltools
  Using cached coremltools-4.1-py3-none-any.whl
Collecting packaging
  Using cached packaging-20.9-py2.py3-none-any.whl (40 kB)
Requirement already satisfied: six>=1.10.0 in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from coremltools) (1.15.0)
Collecting attrs
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting attr
  Using cached attr-0.3.1-py3-none-any.whl
Collecting tqdm
  Using cached tqdm-4.61.1-py2.py3-none-any.whl (75 kB)
Collecting numpy<1.20,>=1.14.5
  Using cached numpy-1.19.5.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting scipy
  Using cached scipy-1.6.3.tar.gz (27.2 MB)
  Installing build dependencies ... -

Then comes this huge error that takes time to copy paste, It was a 1M line of error, can't paste it in here.

我认为问题出在

使用缓存的 scipy-1.6.3.tar.gz (27.2 MB) 安装构建依赖项... \

为此 scipy 安装依赖项 以下是出现巨大错误后的警告。

WARNING: Discarding https://files.pythonhosted.org/packages/99/f1/c00d6be56e1a718a3068079e3ec8ce044d7179345280f6a3f5066068af0d/scipy-1.6.2.tar.gz#sha256=e9da33e21c9bc1b92c20b5328adb13e5f193b924c9b969cd700c8908f315aa59 (from https://pypi.org/simple/scipy/) (requires-python:>=3.7,<3.10). Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /private/var/folders/qf/689v8qpx1n7bqjzjpykz94jw0000gn/T/pip-standalone-pip-woxmm656/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/qf/689v8qpx1n7bqjzjpykz94jw0000gn/T/pip-build-env-voc6ce_x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'wheel<0.37.0' 'setuptools<=51.0.0' 'Cython>=0.29.18,<3.0' 'pybind11>=2.4.3,<2.7.0' 'numpy==1.19.2; python_version=='"'"'3.6'"'"' and platform_machine=='"'"'aarch64'"'"'' 'numpy==1.19.2; python_version=='"'"'3.7'"'"' and platform_machine=='"'"'aarch64'"'"'' 'numpy==1.16.5; python_version=='"'"'3.6'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'numpy==1.19.3; python_version=='"'"'3.9'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'numpy==1.19.0; python_version=='"'"'3.6'"'"' and platform_python_implementation=='"'"'PyPy'"'"'' 'numpy==1.20.0; python_version=='"'"'3.7'"'"' and platform_python_implementation=='"'"'PyPy'"'"'' 'numpy; python_version>='"'"'3.10'"'"'' 'numpy; python_version>='"'"'3.8'"'"' and platform_python_implementation=='"'"'PyPy'"'"'' Check the logs for full command output.

【问题讨论】:

请提及您的python版本 是的,我已经提到了,谢谢。 【参考方案1】:

我正在为 python 3.9.x 安装它,请注意它从今天(2021 年 6 月 19 日)起可用于 3.6.x - 3.8.x。将您的 python 版本更改为 3.6.x - 3.8.x。应该可以的。

【讨论】:

以上是关于无法在 Apple M1 上安装 python lib 'coremltools' - Python 3.9 版的主要内容,如果未能解决你的问题,请参考以下文章

无法在 M1 Mac 上安装 OpenCV Python

在具有 M1 芯片(基于 ARM 的 Apple Silicon)的 Mac 上安装较早版本的 Python(3.8 之前)失败

Xcode 13.1 卡在 Apple M1 Pro 上安装模拟器

如何在 Apple Silicon M1 上原生安装 NodeJS?

在 Apple Silicon M1 Mac 上安装 Cryptography

无法在 M1 Mac 上使用 Pip 安装 OpenCV