docker keras 下 ImportError: cannot import name ctc_ops

来源:互联网 发布:机械三维设计软件排名 编辑:程序博客网 时间:2024/06/05 17:06

运行装有Keras的docker 

常用命令

docker run -i -t -v /data/software/:/mnt/software/ ermaker/keras-jupyter /bin/bash

docker ps -a

docker start container_id

docker attach container_id


Using TensorFlow backend.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/miniconda2/lib/python2.7/site-packages/keras/__init__.py", line 3, in <module>
    from . import activations
  File "/root/miniconda2/lib/python2.7/site-packages/keras/activations.py", line 3, in <module>
    from . import backend as K
  File "/root/miniconda2/lib/python2.7/site-packages/keras/backend/__init__.py", line 73, in <module>
    from .tensorflow_backend import *
  File "/root/miniconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 6, in <module>
    from tensorflow.python.ops import ctc_ops as ctc

ImportError: cannot import name ctc_ops


1. 检查: .keras/keras.json 

{
    "image_dim_ordering": "tf",
    "epsilon": 1e-07,
    "floatx": "float32",
    "backend": "tensorflow"
}

2. 更新tensorflow到最新的版本

pip install tensorflow --upgrade