【问题标题】:Tensorflow error TF error: module compiled against API version 0xe but this version of numpy is 0xdTensorflow 错误 TF 错误:针对 API 版本 0xe 编译的模块但此版本的 numpy 为 0xd
【发布时间】:2022-11-01 16:57:20
【问题描述】:
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "Tensorflow/scripts/generate_tfrecord.py", line 27, in <module>
    import tensorflow.compat.v1 as tf
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python.client import pywrap_tf_session
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in <module>
    from tensorflow.python.client._pywrap_tf_session import *
ImportError: SystemError: <built-in method __contains__ of dict object at 0x000002901E7A0630> returned a result with an error set
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "Tensorflow/scripts/generate_tfrecord.py", line 27, in <module>
    import tensorflow.compat.v1 as tf
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python.client import pywrap_tf_session
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in <module>
    from tensorflow.python.client._pywrap_tf_session import *
ImportError: SystemError: <built-in method __contains__ of dict object at 0x000001B8DA1705E8> returned a result with an error set

【问题讨论】:

    标签: python python-3.x tensorflow


    【解决方案1】:

    请从here 检查 C-API 版本和 Numpy 版本。

    该错误消息表明您有一个提供旧版本 C-API 的 Numpy 版本。基于this,您应该将 Numpy 升级到 1.20.x 或 1.21.x

    请使用以下代码升级 Numpy;

    pip install numpy --upgrade --ignore-installed
    

    或者您可以使用以下内容;

    pip install numpy==1.21.6
    

    【讨论】:

      猜你喜欢
      • 2021-06-29
      • 2018-10-13
      • 2018-06-11
      • 2016-02-24
      • 2016-09-27
      • 2018-09-20
      • 2019-07-28
      • 1970-01-01
      相关资源
      最近更新 更多