M1 Big sur 11.1 中的 numpy 构建失败

新手上路,请多包涵

我正在使用运行 Big Sur 11.1 的 MacBook m1,我已经安装了 Xcode-commandline-tools 版本 12.3 并且它已经安装了 python3.8.5pip3 应用程序,即它们在 ARM 中运行

pip3 版本 20.3.3

python3 版本 3.8.5

setuptools 版本 51.0.0

wheel 版本 0.36.2

当我键入 python3 -m pip install numpy

输出是:

 Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
  Using cached numpy-1.19.4.zip (7.3 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'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517): started
sandeep@Sandeeps-Air ~ % cat a
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
  Using cached numpy-1.19.4.zip (7.3 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'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: numpy
  Building wheel for numpy (PEP 517): started
  Building wheel for numpy (PEP 517): finished with status 'error'
Failed to build numpy

并且有很多 错误

M1 仍然不支持 numpy 还是我做错了?

原文由 zsh 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 513
1 个回答

我的全新 Mac Mini 也遇到了完全相同的问题。花了一个下午 在github上看了这个issue ,终于成功了。但是,它似乎只适用 于 v1.20.0rc2 或更高版本……

长话短说,这些是我为使其正常工作而采取的步骤:

 pip3 install Cython
git clone https://github.com/numpy/numpy.git
cd numpy
pip3 install . --no-binary :all: --no-use-pep517

之后,我可以 cd 进入我的 virtualenv 并导入 numpy:

 >>> import numpy as np
>>> np.__version__
'1.21.0.dev0+402.gc4ae3ce64'
>>>

接下来:熊猫。

更新: 经过更多搜索,我发现 了这篇有趣的文章,其中指出您可以轻松地以 Rosatta 模式启动终端。这也解决了问题。

但是,我使用的是无头 Mac Mini,所以我仍然需要确定该解决方案在该特定设置中是否也可行。

更新 2

多亏了 SO 上的这个答案,我现在也有熊猫在工作了。

原文由 Bart Barnard 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题