这是我尝试导入时得到的结果
>>> import numpy
Python(26024,0x11da32dc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744071675105280, flags: 100) failed (error code=3)
Python(26024,0x11da32dc0) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/__init__.py", line 286, in <module>
raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
以下是您可能想了解的其他信息。
我安装了
numpy
。eric@Erics-MacBook-Pro ~ % pip3 install numpy
已满足要求:
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.19.2) 中的 numpy
我最近删除了
oh-my-zsh
但没有完全删除,所以当我打开终端时总会出现这种情况。上次登录:10 月 6 日星期二 17:57:22,在 ttys002/Users/eric/.zshrc:source:73:没有这样的文件或目录:/Users/eric/.oh-my-zsh/oh -my-zsh.sh
如果您需要什么,请告诉我。
最佳答案
我在尝试导入pandas
(需要numpy
)时遇到了完全相同的问题。基本上,由于某些非常奇怪的原因,Python 3.9 在 macOS 上不能与 numpy
很好地配合。降级到Python 3.8,一切正常:https://www.python.org/downloads/release/python-386/ .
关于python-3.x - 即使我使用 pip3 安装,也无法导入 NumPy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64222756/