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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章