Python tf.contrib.learn Quickstart中出错,没有名为load\u csv的属性

Python tf.contrib.learn Quickstart中出错,没有名为load\u csv的属性,python,macos,python-2.7,tensorflow,osx-elcapitan,Python,Macos,Python 2.7,Tensorflow,Osx Elcapitan,我开始使用OSX上的tensorflow,并按照pip安装指南安装了最新版本,使用: echo $TF_BINARY_URL https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py2-none-any.whl 快速概述: OS:OS X El Capitan版本10.11.6(15G31) Python:Python 2.7.12_1与brew安装Python一起安装 TensorFlow:0.11.0

我开始使用OSX上的tensorflow,并按照pip安装指南安装了最新版本,使用:

echo $TF_BINARY_URL
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0rc0-py2-none-any.whl
快速概述:

OS:OS X El Capitan版本10.11.6(15G31)

Python:Python 2.7.12_1与
brew安装Python一起安装

TensorFlow:0.11.0rc0从
导入TensorFlow作为tf;打印(tf.\uuuu版本)

我可以使用以下方法运行TensorFlow:

python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
>>> Hello, TensorFlow!
因此,安装了TensorFlow并运行基本命令

但当我从这里运行tf.contrib.learn Quickstart的代码时:

我得到以下问题:

Traceback (most recent call last):
  File "tf_learn_quickstart.py", line 13, in <module>
    training_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TRAINING,
AttributeError: 'module' object has no attribute 'load_csv'
回溯(最近一次呼叫最后一次):
文件“tf_learn_quickstart.py”,第13行,在
training\u set=tf.contrib.learn.dataset.base.load\u csv(文件名=IRIS\u training,
AttributeError:“模块”对象没有“加载”属性

我无法找出哪里出了问题,因为其他一切似乎都正常工作。有什么想法吗?

此函数已被弃用:


而且教程似乎不是最新的。我相信您可以简单地将load_csv替换为load_csv_with_header以使其正常工作。

对于希望运行教程的人来说,这是一个快速解决方案

替换

# Load datasets.
training_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TRAINING,
                                                       target_dtype=np.int)
test_set = tf.contrib.learn.datasets.base.load_csv(filename=IRIS_TEST,
                                                   target_dtype=np.int)


谢谢。我用带有标题的load\u csv\u替换了load\u csv\u,并为功能\u dtype=np.float32添加了额外的参数。@IsaacNoble它是
features\u dtype
。From:
load\u csv\u with\u header(文件名、目标\u dtype、功能\u dtype、目标\u列=-1)
# Load datasets.
training_set = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TRAINING,
                                                                  target_dtype=np.int,
                                                                  features_dtype=np.float32,
                                                                  target_column=-1)
test_set     = tf.contrib.learn.datasets.base.load_csv_with_header(filename=IRIS_TEST,
                                                                  target_dtype=np.int,
                                                                  features_dtype=np.float32,
                                                                  target_column=-1)