当前位置:   article > 正文

ubuntu已解决解决报错:Check failed: PyBfloat16_Type.tp_base != nullptr已放弃 (核心已转储)_ubuntu modulenotfounderror: no module named 'numpy

ubuntu modulenotfounderror: no module named 'numpy

问题描述

在python3中import keras时报错:
在这里插入图片描述

完整错误日志:
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: <class ‘_frozen_importlib._ModuleLockManager’> 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 "<stdin>", 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

从代码看出是keras版本不匹配
查阅tensorflow-gpu与keras版本对应:
在这里插入图片描述
查表后安装对应keras
pip3 install keras==2.2.4
再次在python3中import keras

在这里插入图片描述
搞定

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/800300
推荐阅读
相关标签
  

闽ICP备14008679号