赞
踩
在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
从代码看出是keras版本不匹配
查阅tensorflow-gpu与keras版本对应:
查表后安装对应keras
pip3 install keras==2.2.4
再次在python3中import keras
搞定
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。