简体   繁体   English

没有名为 tensorflow.contrib.learn 的模块

[英]No module named tensorflow.contrib.learn

I have tried installing tenserflow in my ubuntu os but i get error as no module what may be the problem !!我曾尝试在我的 ubuntu 操作系统中安装 tenserflow 但我收到错误,因为没有模块可能是什么问题!!

My code :我的代码:

import tensorflow.contrib.learn as learn
from sklearn import datasets, metrics

iris = datasets.load_iris()
feature_columns = learn.infer_real_valued_columns_from_input(iris.data)
classifier = learn.LinearClassifier(n_classes=3, feature_columns=feature_columns)
classifier.fit(iris.data, iris.target, steps=200, batch_size=32)
iris_predictions = list(classifier.predict(iris.data, as_iterable=True))
score = metrics.accuracy_score(iris.target, iris_predictions)
print("Accuracy: %f" % score)

In order to use import tensorflow.contrib.learn as learn this library use Tensorflow 1.15 version.为了使用import tensorflow.contrib.learn as learn这个库,请使用 Tensorflow 1.15 版本。 install Tensorflow 1.15 using使用安装 Tensorflow 1.15

pip install tensorflow==1.15

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:模块'tensorflow.contrib.learn'没有属性'TensorFlowDNNClassifier' - AttributeError: module 'tensorflow.contrib.learn' has no attribute 'TensorFlowDNNClassifier' 模块'tensorflow.contrib.learn'没有属性'python' - module 'tensorflow.contrib.learn' has no attribute 'python' Tensorflow:没有名为 contrib.learn.python.learn.datasets.mnist 的模块 - Tensorflow: No module named contrib.learn.python.learn.datasets.mnist 没有名为“tensorflow.contrib”的模块 - No module named 'tensorflow.contrib' 没有名为 tensorflow.contrib 的模块 - no module named tensorflow.contrib Tensorflow> ModuleNotFoundError:没有名为'tensorflow.contrib'的模块 - Tensorflow > ModuleNotFoundError: No module named 'tensorflow.contrib' ModuleNotFoundError:没有名为“tensorflow.contrib”的模块错误 - ModuleNotFoundError: No module named 'tensorflow.contrib' Error ModuleNotFoundError:没有名为“tensorflow.contrib.tensorboard”的模块 - ModuleNotFoundError: No module named 'tensorflow.contrib.tensorboard' 错误:ModuleNotFoundError:没有名为“tensorflow.contrib”的模块 - Error: ModuleNotFoundError: No module named 'tensorflow.contrib' ModuleNotFoundError:没有名为“tensorflow.contrib”的模块,tensorflow=2.0.0 - ModuleNotFoundError: No module named 'tensorflow.contrib' with tensorflow=2.0.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM