尝试导入与后端相关的 keras 时出现 AssertionError

AssertionError when attempting to import keras related to backend

因此,当尝试导入 keras 时,出现以下 AssertionError:

    /home/m7nz/anaconda3/envs/ninja-01/lib/python3.6/site-packages/keras/backend/__init__.py in <module>()
     32     assert isinstance(_epsilon, float)
     33     _backend = _config.get('backend', _BACKEND)
---> 34     assert _backend in {'theano', 'tensorflow'}
     35     _image_data_format = _config.get('image_data_format',
     36                                      image_data_format())

AssertionError: 

keras.json如下:

{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "theanos",
"image_data_format": "channels_last"

我尝试删除 init.py 文件中对 tensorflow 的引用,但错误仍然存​​在。

它在 Linux 机器上,运行 ubuntu 16. 使用 Anaconda3。其实是在anaconda环境下。

感谢您的帮助。

改变

"backend": "theanos",

"backend": "theano",

那只是您 json 文件中的错字:-)