【问题标题】:Anaconda with Tensorflow: No module named any_pb2带有 Tensorflow 的 Anaconda:没有名为 any_pb2 的模块
【发布时间】:2016-02-25 13:08:15
【问题描述】:

我刚刚在 Ubuntu 14.04 中安装了 Anaconda。然后我使用

安装了tensorflow
conda install -c https://conda.anaconda.org/jjhelmus tensorflow

然后我安装了protobuf

conda install -c https://conda.anaconda.org/anaconda protobuf

但是,我无法解决这个问题:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
    builtins.execfile(filename, *where)
  File "/home/daniel/Documents/Cursos/UnB/Metodos Computacionais/2016/Notas de Aula/Part II - Aula 1 Regression Linear Models/biasVersusVarianceSeveralData.py", line 8, in <module>
    import tensorflow as tf
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 69, in <module>
    from tensorflow.python.training import training as train
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/training.py", line 149, in <module>
    from tensorflow.python.training.saver import generate_checkpoint_state_proto
  File "/home/daniel/anaconda2/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 29, in <module>
    from google.protobuf.any_pb2 import Any
ImportError: No module named any_pb2

【问题讨论】:

  • 您是否考虑过采用不同的安装路径并使用instructions on the TensorFlow site?由于 TensorFlow 源代码不断更新,因此很难保证构建能够安装,但检查持续集成站点应该是有价值的。
  • 太棒了!我是直接从谷歌安装的!谢谢!

标签: python anaconda tensorflow


【解决方案1】:

使用instructions on the TensorFlow site

TLDR;

我将其发布为答案,因为人们不会在 cmets 中寻找答案。

【讨论】:

    【解决方案2】:

    这是我在 github 上对这个问题的评论,希望对您有所帮助。

    “对于遇到同样问题的其他人,我在尝试通过 jupyter 在笔记本上导入 tensorflow 时也遇到了类似的问题。模块是使用 conda 安装的。花了两天时间没有任何成功(不断得到同样,没有模块any_pb2 / contrib),很明显这是一个笔记本问题,与tensorflow无关,因为我可以从python shell导入tensorflow。所以我决定切换回vanilla python并手动安装所有东西(tensorflow via pip & got摆脱了 jupyter 并安装了 ipython),现在我可以从我的 ipython 笔记本中导入 tensorflow。”

    原评论链接:https://github.com/tensorflow/tensorflow/issues/1161#issuecomment-188664103

    【讨论】:

      【解决方案3】:

      以下内容对我有用:

      conda install -c https://conda.anaconda.org/jjhelmus张量流

      【讨论】:

        猜你喜欢
        • 2017-10-17
        • 1970-01-01
        • 2017-11-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多