我一直在尝试使用 tensorflow 两天,现在在 python2.7 和 3.4 中一遍又一遍地安装和重新安装它。无论我做什么,在尝试使用 tensorflow.placeholder() 时都会收到此错误消息
这是非常样板代码:
tf_in = tf.placeholder("float", [None, A]) # Features
无论我做什么,我总能得到回溯:
Traceback (most recent call last):
File "/home/willim/PycharmProjects/tensorflow/tensorflow.py", line 2, in <module>
import tensorflow as tf
File "/home/willim/PycharmProjects/tensorflow/tensorflow.py", line 53, in <module>
tf_in = tf.placeholder("float", [None, A]) # Features
AttributeError: 'module' object has no attribute 'placeholder'
任何人都知道我该如何解决这个问题?
原文由 user3023715 发布,翻译遵循 CC BY-SA 4.0 许可协议
它也发生在我身上。我有 tensorflow,它工作得很好,但是当我在之前的 tensorflow 旁边安装 tensorflow-gpu 时,出现了这个错误,然后我做了这 3 个步骤,它开始工作没有问题:
conda remove tensorflow-gpu tensorflow tensorflow-base
conda install tensorflow