【问题标题】:module 'tensorflow.contrib.learn' has no attribute 'python'模块“tensorflow.contrib.learn”没有属性“python”
【发布时间】:2017-12-08 23:49:05
【问题描述】:
import tensorflow.contrib.learn.python.learn as learn

home/michael/miniconda3/lib/python3.6/importlib/_bootstrap.py:219:
RuntimeWarning: compiletime version 3.5 of module  
'tensorflow.python.framework.fast_tensor_util' does not match runtime 
version 3.6
return f(*args, **kwds)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-630a74eb6a34> in <module>()
----> 1 import tensorflow.contrib.learn.python.learn as learn

AttributeError: module 'tensorflow.contrib.learn' has no attribute 'python'

我正在尝试在 linux 环境下的 jupyter 中导入这个库,我在 google 上找不到任何答案。

【问题讨论】:

    标签: python tensorflow data-science


    【解决方案1】:

    实际上,tensorflow.contrib.learn 模块从tensorflow.contrib.learn.python.learn 重新导入所有内容:

     91 # pylint: disable=wildcard-import
     92 from tensorflow.contrib.learn.python.learn import *
     93 # pylint: enable=wildcard-import
     94 
     95 from tensorflow.contrib.learn.python.learn import learn_runner_lib as learn_runner
    

    所以你可以直接导入它:

    import tensorflow.contrib.learn as learn
    

    from tensorflow.contrib import learn
    

    【讨论】:

      猜你喜欢
      • 2017-05-13
      • 2017-03-05
      • 1970-01-01
      • 2023-04-06
      • 2015-12-17
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多