我正在关注位于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的顶部)运行上述两个命令
环境:
答案 0 :(得分:0)
我解决了这个问题。未安装autograd
依赖项。这可以通过运行pip install autograd
答案 1 :(得分:0)
您必须在编译之前配置TensorFlow,因此它会设置所有依赖项:./configure