AttributeError:模块“ tensorflow”没有属性“ feature_column”

Ank*_*Ank 5 python machine-learning tensorflow

因此,我是机器学习的新手,并正在尝试这里提供的TensorFlow线性模型教程:https : //www.tensorflow.org/tutorials/wide

我从字面上下载了他们的教程,并试图在我的计算机上运行它,但是出现了错误:

AttributeError:模块“ tensorflow”没有属性“ feature_column”

我在网上搜索后发现这可能会在旧版本的tensorflow上发生,但我正在运行最新版本:1.3.0

那么,为什么我会收到此错误以及如何解决呢?

Max*_*Max 3

Tensorflow 1.3应该很好地支持feature_column。您可能不小心使用了旧版本。尝试使用以下代码来验证您的版本:

import tensorflow as tf
print(tf.__version__)
print(dir(tf.feature_column))
Run Code Online (Sandbox Code Playgroud)