我在Jupyter笔记本上写下面的代码。AttributeError:模块'tensorflow'没有属性'图'
import tensorflow as tf
g = tf.Graph()
而我在执行此简单代码时遇到以下错误。
AttributeError: module 'tensorflow' has no attribute 'Graph'
如果我从控制台执行相同的操作。有用。任何想法发生了什么。
更多信息:(测试我的virtualenv)
IPython中,jupyter,Python版本:
(test) [email protected]:~/tensorflow$ which ipython3
/home/xingzhou/tensorflow/test/bin/ipython3
(test) [email protected]:~/tensorflow$ which jupyter
/home/xingzhou/tensorflow/test/bin/jupyter
(test) [email protected]:~/tensorflow$ which python3
/home/xingzhou/tensorflow/test/bin/python3
从控制台执行:
(test) [email protected]:~/tensorflow$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> g = tf.Graph()
>>> type(g)
<class 'tensorflow.python.framework.ops.Graph'>
>>>