我使用pip install构建了v0.8.0的tensorflow,但是当我尝试任何skflow示例时,它们都因为
而失败AttributeError: 'module' object has no attribute 'datasets'
这是
的结果from tensorflow.contrib import learn
### Training data
# Downloads, unpacks and reads DBpedia dataset.
dbpedia = learn.datasets.load_dataset('dbpedia')
答案 0 :(得分:5)
有几个人遇到过这种情况。请安装最新版本,.e.g。最近的夜间建筑之一。
从命令行运行
pip3 install --upgrade http://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_CONTAINER_TYPE=CPU,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
答案 1 :(得分:3)
我发现解决此问题的一种不那么烦人的方法就是手动下载和加载数据。这很简单,我就是这样做的。
from tensorflow.contrib import learn
# Downloads, unpacks and reads DBpedia dataset.
## dbpedia = learn.datasets.load_dataset('dbpedia')
## BUT THAT ABOVE FUNCTION DOESN'T WORK SO....
## MANUALLY DOWNLOAD THE DATA FROM THIS LINK:
## https://googledrive.com/host/0Bz8a_Dbh9Qhbfll6bVpmNUtUcFdjYmF2SEpmZUZUcVNiMUw1TWN6RDV3a0JHT3kxLVhVR2M/dbpedia_csv.tar.gz
## MANUALLY UNPACK THE DATA BY DOUBLE CLICKING IT
## make sure the paths are correct
## LOAD IT LIKE YOU WOULD A REGULAR CSV FILE.
train = pandas.read_csv('dbpedia_csv/train.csv', header=None)
X_train, y_train = train[2], train[0]
test = pandas.read_csv('dbpedia_csv/test.csv', header=None)
X_test, y_test = test[2], test[0]
答案 2 :(得分:0)
您好我似乎有相同的问题,并将其追溯到〜/ skflow / lib / python2.7 / site-packages / tensorflow / contrib / learn / python / learn / datasets init 。 py没有dbpedia作为数据集,但它的github版本有它。我正在使用版本0.8.0的张量流