我正在关注位于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 回答
我解决了这个问题 . 未安装
autograd
依赖项 . 这可以通过运行pip install autograd
来解决您必须在编译之前配置TensorFlow,因此它会设置所有依赖项:
./configure