Tensorflow图像再培训教程Bazel错误

时间:2017-08-31 23:40:28

标签: tensorflow

我正在关注位于here的Tensorflow图像再培训教程。

当我尝试使用bazel运行此命令时:

bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos

我收到以下错误:

Traceback (most recent call last):
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 108, in <module>
import tensorflow as tf
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 63, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 76, in <module>
from tensorflow.python.framework.ops import Graph
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/ops.py", line 28, in <module>
from autograd import core as ag_core

ModuleNotFoundError:没有名为'autograd'的模块

但是,当我使用python命令运行它时

python tensorflow/examples/image_retraining/retrain.py --image_dir ~/flower_photos

它正确运行并且不会生成此错误。

我从~/tensorflow目录(git repo的顶部)运行上述两个命令

环境:

  • Ubuntu 17.04
  • Python 3.6.1
  • Anaconda 4.4.0
  • Bazel 0.5.4
  • Tensorflow 1.3(无GPU)(v1.3.0-rc2-20-g0787eee 1.3.0)

2 个答案:

答案 0 :(得分:0)

我解决了这个问题。未安装autograd依赖项。这可以通过运行pip install autograd

来解决

答案 1 :(得分:0)

您必须在编译之前配置TensorFlow,因此它会设置所有依赖项:./configure