即使我安装了pip3,也无法导入NumPy

时间:2020-10-06 09:14:23

标签: python-3.x numpy import

这是我尝试导入时得到的内容

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

这是您可能想知道的其他信息。

  1. 我安装了numpy

    eric@Erics-MacBook-Pro ~ % pip3 install numpy

    已满足要求:numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.19.2)

  2. 我最近擦除了oh-my-zsh,但没有完全擦除,因此在打开终端时总是会出现这种情况。

    Last login: Tue Oct 6 17:57:22 on ttys002 /Users/eric/.zshrc:source:73: no such file or directory: /Users/eric/.oh-my-zsh/oh-my-zsh.sh

如果有什么需要,请告诉我。

1 个答案:

答案 0 :(得分:2)

在尝试导入pandas(需要numpy)时遇到了完全相同的问题。基本上,由于某些非常奇怪的原因, Python 3.9 在macOS上无法与numpy配合使用。降级为 Python 3.8 ,一切运行正常:https://www.python.org/downloads/release/python-386/