RuntimeError:针对 API 版本 0xe 编译的模块,但这个版本的 numpy 是 0xd

Posted

技术标签:

【中文标题】RuntimeError:针对 API 版本 0xe 编译的模块,但这个版本的 numpy 是 0xd【英文标题】:RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd 【发布时间】:2021-06-29 18:32:32 【问题描述】:

我可以毫无问题地导入 numpy。但是,在尝试导入 easyocr 时出现以下错误:

>>> %Run numpytst.py
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "/home/pi/numpytst.py", line 2, in <module>
    import easyocr
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/__init__.py", line 1, in <module>
    from .easyocr import Reader
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/easyocr.py", line 3, in <module>
    from .detection import get_detector, get_textbox
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/detection.py", line 9, in <module>
    from .craft_utils import getDetBoxes, adjustResultCoordinates
  File "/home/pi/.local/lib/python3.7/site-packages/easyocr/craft_utils.py", line 10, in <module>
    from scipy.ndimage import label
  File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/__init__.py", line 151, in <module>
    from .filters import *
  File "/home/pi/.local/lib/python3.7/site-packages/scipy/ndimage/filters.py", line 37, in <module>
    from . import _nd_image
ImportError: numpy.core.multiarray failed to import

环境:

树莓派 3B Python 3.7.3 numpy 1.16.6

【问题讨论】:

【参考方案1】:

您是否尝试过升级到更新的版本?像 1.20.x。我通过简单地将我的 NumPy 升级到 1.20.3 版解决了类似的错误。

【讨论】:

以上是关于RuntimeError:针对 API 版本 0xe 编译的模块,但这个版本的 numpy 是 0xd的主要内容,如果未能解决你的问题,请参考以下文章

RuntimeError:针对 API 版本 a 编译的模块,但这个版本的 numpy 是 9

Opencv / numpy问题:“针对API版本X编译的模块,但这个版本的numpy是Y”

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 / ImportError

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa

解决 RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd

解决 RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd