遵循此文档:,我在安装 tensorflow 版本为 1.8.0 且 python 版本为 2.7.13 后尝试运行这些行。
*import tensorflow as tf
tf.enable_eager_execution()*
我转到安装 tensorflow 的顶级目录中的 jupyter notebook 并创建一个新的 jupyter notebook,然后运行上面的行,得到了这个错误:
*---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-1ff77c8b7a69> in <module>()
1 import tensorflow as tf
2 from __future__ import absolute_import, division, print_function
----> 3 tf.enable_eager_execution()
AttributeError: 'module' object has no attribute 'enable_eager_execution'*
但是当我从终端访问python或使用ipython时,我可以成功运行这两行。有谁知道这是为什么,我该如何解决笔记本中的问题?