2021 年 1 月更新:我在 2021 年 1 月执行了 Big Sur 的全新安装,并使用 python3 -m pip install --upgrade pip --user
将 pip 升级到最新版本,并安装 numpy
没有问题,也没有下面的错误消息。
2020 年 11 月的原始问题
我在 2019 macbook pro 上使用 macOS big sur。我可以使用 python3 -m pip install numpy --user
安装 numpy .注意我没有 brew;我只是使用 Xcode 命令行工具中的 python3。我在许多其他地方看到过这个错误报告,但他们似乎都使用 brew。
但是,当我尝试 import numpy as np
,我收到以下错误消息。
Python(488,0x11700be00) malloc: can't allocate region
:*** mach_vm_map(size=18446744071565352960, flags: 100) failed (error code=3)
Python(488,0x11700be00) 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 "/Users/xdavidliu/Library/Python/3.8/lib/python/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(并导致崩溃)是 1.19。我能够通过以下解决方法使用 numpy:
python3 -m pip uninstall numpy
python3 -m pip install numpy==1.18.0 --user
关于python - 由于 polyfit 错误,macOS Big Sur python3 无法导入 numpy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64956168/