macbook M1芯片 使用numpy报错:(have 'arm64', need 'x86_64')

运行import numpy报错信息大致如下:

(mach-o file, but is an incompatible architecture(have 'arm64', need 'x86_64'))

解决办法:
1、查看当前架构uname -a

Darwin MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

2、切换架构 arch -x86_64 zsh
3、再次查看架构uname -a

Darwin MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 x86_64

4、卸载numpy,重新安装

 > pip3 uninstall numpy
 > pip3 install numpy

你可能感兴趣的:(macbook M1芯片 使用numpy报错:(have 'arm64', need 'x86_64'))