Jupyter笔记本中的Tensorflow错误

Jupyter笔记本中的Tensorflow错误,tensorflow,jupyter-notebook,Tensorflow,Jupyter Notebook,在AWS的Ubuntu 16.0上安装tensorflow之后, 通过使用: conda install -c conda-forge tensorflow=1.2.1 在终端SSH上键入时: ipython import tensorflow as tf tf.__version__ 它返回1.2.1,一切正常 但是,当这段代码在Jupyter Ipython笔记本上运行时 从相同的python安装(anaconda)启动, 我得到了这个错误: ----------------------

在AWS的Ubuntu 16.0上安装tensorflow之后, 通过使用:

conda install -c conda-forge tensorflow=1.2.1
在终端SSH上键入时:

ipython
import tensorflow as tf
tf.__version__
它返回1.2.1,一切正常

但是,当这段代码在Jupyter Ipython笔记本上运行时 从相同的python安装(anaconda)启动, 我得到了这个错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-b6f7b46cc0dd> in <module>()
      1 import tensorflow as tf
----> 2 tf.__version__

AttributeError: module 'tensorflow' has no attribute '__version__'
---------------------------------------------------------------------------
AttributeError回溯(最近一次呼叫上次)
在()
1导入tensorflow作为tf
---->2 tf.\u版本__
AttributeError:模块“tensorflow”没有属性“版本”
我不明白这个错误是怎么发生的,因为python发行版 是一样的

有没有办法检查Tensorflow的安装情况

编辑: 本帖 显示它可能与对某些文件夹的sudo访问有关。。。。安装时。
TBD

请您详细解释一下您的问题好吗?例如,您使用的是GPU还是仅CPU版本?您是如何安装Tensorflow的?等等。我们不在您的大脑中,无法访问您的系统:P此外,您应该首先阅读Github问题,如thx you very,probable sudo on folder….在Jupyter中,在
将tensorflow导入tf
后,您能否打印
dir(tf)
的值并将其添加到您的问题中?我怀疑问题在于Python的两个实例之间的
PYTHONPATH
不同。我得到了相同的问题。我在conda环境下运行jupyter笔记本。好的,我想我在我的案例中发现了问题。我在conda环境之外安装了jupyter笔记本电脑。所以我停用了环境,卸载了jupyter,然后再次激活,并在我的环境中安装了jupyter。