You need to enable JavaScript to run this app. M1芯片Big Sur 11.1环境下numpy安装构建失败问题咨询
优惠活动
大模型
产品
解决方案
定价
更多

M1芯片Big Sur 11.1环境下numpy安装构建失败问题咨询

问题基础环境
  • 硬件与系统:搭载M1芯片的MacBook,运行Big Sur 11.1系统
  • 已配置的开发环境:
    • 12.3版本Xcode-commandline-tools,配套预装了可在ARM架构下原生运行的python3.8.5与pip3
    • 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
  Building wheel for numpy (PEP 517): finished with status 'error'
Failed to build numpy

安装过程同步输出了大量编译类错误日志,可用于精准定位构建问题。

问题核心结论

该报错并非操作不当导致,根因是版本适配的时间差问题:

  • 尝试安装的numpy 1.19.4版本发布于2020年11月,早于M1芯片Mac的正式上市时间,这个版本在PyPI源上根本没有发布适配Apple Silicon ARM架构的预编译二进制安装包
  • pip检测不到匹配当前系统的安装包时,会自动拉取对应源码包尝试本地编译,而numpy 1.19.4的源码尚未加入M1架构的编译兼容逻辑,哪怕Xcode命令行工具配置完全正确,也无法顺利完成本地编译,最终触发构建失败。

补充说明:执行安装时出现的"Defaulting to user installation"提示,是系统对无写入权限的全局site-packages目录的默认兼容机制,不会直接导致本次编译失败。

当时可行的解决方向
  • 直接升级安装1.21.0及以上正式适配M1架构的numpy版本,无需源码编译即可通过pip完成安装
  • 若必须使用numpy 1.19.x旧版本,可在编译环节手动指定匹配ARM架构的编译参数,完成源码构建后再安装

内容的提问来源于stack exchange,提问作者zsh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.12 13:36:05