運行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