首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ImportError:没有名为“backports”的模块

ImportError:没有名为“backports”的模块
EN

Stack Overflow用户
提问于 2017-06-16 17:30:20
回答 1查看 11K关注 0票数 3

在使用tensorflow安装再培训模型时,我运行了以下命令:

代码语言:javascript
复制
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir <..directory..>

错误:

代码语言:javascript
复制
ImportError: No module named 'backports'

Traceback (most recent call last):
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 91, in <module>
    import tensorflow as tf
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 64, in <module>
    from tensorflow.python.framework.framework_lib import *
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 100, in <module>
    from tensorflow.python.framework.subscribe import subscribe
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/subscribe.py", line 26, in <module>
    from tensorflow.python.ops import variables
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variables.py", line 26, in <module>
    from tensorflow.python.ops import control_flow_ops
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/control_flow_ops.py", line 70, in <module>
    from tensorflow.python.ops import tensor_array_ops
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/tensor_array_ops.py", line 33, in <module>
    from tensorflow.python.util import tf_should_use
  File "/home/nishith/tensorflow/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/util/tf_should_use.py", line 28, in <module>
    from backports import weakref  # pylint: disable=g-bad-import-order
ImportError: No module named 'backports'
EN

回答 1

Stack Overflow用户

发布于 2017-06-17 23:32:38

尝试:

代码语言:javascript
复制
pip install backports.weakref
票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44585735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档