【问题标题】:macOS Big Sur python3 cannot import numpy due to polyfit error由于 polyfit 错误,macOS Big Sur python3 无法导入 numpy
【发布时间】:2021-03-05 10:41:05
【问题描述】:

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

【问题讨论】:

    标签: python macos numpy macos-big-sur xcode-command-line-tools


    【解决方案1】:

    我的问题中默认安装的 numpy(导致崩溃)是 1.19。我能够通过以下解决方法使用 numpy:

    python3 -m pip uninstall numpy
    python3 -m pip install numpy==1.18.0 --user
    

    【讨论】:

    • 即使我显然没有安装恶意 numpy 版本,我仍然收到此错误。我尝试运行第一个命令来卸载 numpy 并得到了这个:WARNING: Skipping numpy as it is not installed.
    猜你喜欢
    • 1970-01-01
    • 2021-01-06
    • 2021-03-15
    • 2021-02-26
    • 2021-06-08
    • 2022-01-14
    • 2021-03-01
    • 2021-09-04
    • 2021-11-26
    相关资源
    最近更新 更多