ubuntu已解决解决报错:Check failed: PyBfloat16_Type.tp_base != nullptr已放弃 (核心已转储)

问题描述

在python3中import keras时报错:
ubuntu已解决解决报错:Check failed: PyBfloat16_Type.tp_base != nullptr已放弃 (核心已转储)_第1张图片

完整错误日志:
ModuleNotFoundError: No module named ‘numpy.core._multiarray_umath’
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “

SystemError: returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2020-07-05 20:02:22.025374: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr
已放弃 (核心已转储)

解决方法:

从代码中看出是numpy版本不匹配的问题,可以尝试:pip install --user --upgrade numpy
再次在python执行import keras
在末尾出现错误:

ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/keras/__init__.py", line 6, in <module>
    'Keras requires TensorFlow 2.2 or higher. '
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

从代码看出是keras版本不匹配
查阅tensorflow-gpu与keras版本对应:
ubuntu已解决解决报错:Check failed: PyBfloat16_Type.tp_base != nullptr已放弃 (核心已转储)_第2张图片
查表后安装对应keras
pip3 install keras==2.2.4
再次在python3中import keras

ubuntu已解决解决报错:Check failed: PyBfloat16_Type.tp_base != nullptr已放弃 (核心已转储)_第3张图片
搞定

你可能感兴趣的:(Jetson,Nano)