【问题标题】:cannot import name 'bayesflow' tensorflow 1.4.1无法导入名称“bayesflow”张量流 1.4.1
【发布时间】:2018-02-17 22:18:25
【问题描述】:

正如其他人提到的我需要更新 dask,我这样做了,现在 conda 说它是正确的。仍然 tensorflow 找不到它。见鬼

SONY@instance-1:~/anaconda3/pkgs$ conda install dask 解决环境:完成

已安装所有请求的软件包。

SONY@instance-1:~/anaconda3/pkgs$ conda update dask 解决环境:完成

已安装所有请求的软件包。

>>> import tensorflow as tf
>>> tf.__version__
'1.4.1'

>>> import tensorflow as tf
>>> from tensorflow.examples.tutorials.mnist import input_data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/SONY/anaconda3/lib/python3.5/site-
from tensorflow.contrib import bayesflow
ImportError: cannot import name 'bayesflow'

说真的WTF! 我该如何解决这个问题?

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    以尽可能多的 CS 方式摆脱它。 已卸载 tensorflow,Anaconda。

    为 python 3.6 安装 Anaconda,安装 tensorflow-gpu 版本 1.4.1

    它就像一个魅力。 tf 使用 gpu 并且不抱怨bayesflow

    【讨论】:

      【解决方案2】:

      首先,您导入为tf--但随后您使用tensorflow.whatever 而不是tf.whatever。其次,您的错误与您发布的导入无关。

      【讨论】:

      • 认真的吗?我在我的 aws 实例上运行 >>> import tensorflow as tf >>> from tensorflow.examples.tutorials.mnist import input_data 并且它有效。它有 python 2.7.12 和 tf.__version__ 是 1.3.0
      • 在我的本地系统上,我有 conda 和 python 3,5 和 tensorflow 1.4.1,但它不起作用。
      • 当你告诉 python 你将 tensorflow 作为 tf 导入时,那么你必须使用 tf 作为模块名称——而不是 tensorflow。您应该收到类似NameError: name 'tensorflow' is not defined 的错误消息。不如直接写import tensorflow 看看会发生什么? 在我的 aws 实例上,它起作用了。-- 然后某处的语句:import tensorflow 被执行。
      • 这肯定不是问题,否则它不适用于 python 2.7.12。 Anaconda 和 Tensforflow 发生了一些不稳定的事情。因为 import tensorflow as tf 和 from tensorflow... import ... 肯定是不同的语句
      • 我不知道,但是如果你使用名称 tensorflow,那么在某处执行 import tensorflow 行,如果你从不使用名称 tf,写 import tensorflow as tf 是浪费时间。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-21
      • 1970-01-01
      • 2019-02-02
      • 1970-01-01
      • 2021-07-30
      • 1970-01-01
      相关资源
      最近更新 更多