【问题标题】:Why python2.7 import "from tensorflow.python.util import nest " failed为什么 python2.7 import "from tensorflow.python.util import nest" 失败
【发布时间】:2016-12-18 11:32:18
【问题描述】:

我用python2.7失败了

在python2.7中

>>> from tensorflow.python.util import nest 
Traceback (most recent calllast): 
  File "<stdin>", line 1, in <module> 
ImportError: cannot import name nest

但是我尝试使用python3.5运行from tensorflow.python.util import nest是可以的

【问题讨论】:

  • 你为python2安装了tensorflow吗?它在 python3 中可导入仅意味着您已经为该安装安装了它,python2 安装完全独立于该安装。

标签: python python-2.7 tensorflow importerror


【解决方案1】:

我能够在 python 2.7 上运行该导入语句而没有任何问题。也许您的 python 2 安装不可靠或者您的 tensorflow 已过时(我正在运行 0.12.0-rc1)。

Python 2.7.12 (default, Dec  1 2016, 21:24:23) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>>> from tensorflow.python.util import nest 
>>> 

【讨论】:

  • 当前版本为0.12,请升级重试。
猜你喜欢
  • 2023-02-22
  • 1970-01-01
  • 2017-02-27
  • 2019-06-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-23
  • 1970-01-01
相关资源
最近更新 更多