【发布时间】:2016-05-17 06:43:26
【问题描述】:
我按照以下说明在我的系统上安装了 TensorFlow https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#download-and-setup 并尝试了 pip 安装和 anaconda 安装。我尝试运行几个示例,但没有一个有效。
>>> import tensorflow
>>> tensorflow.InteractiveSession()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
>>> a = tensorflow.zeros((2,2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'zeros'
对于许多其他功能,我得到了同样的错误。我已经安装了支持 GPU 的 TensorFlow 0.8、Python 3.5.1 和 Ubuntu 15.10 64bit。我记得在我安装 Anaconda(3) 之前一切运行良好,我这样做是为了获得 Numpy 和 Scipy。之后我也有点弄乱了python路径。现在,当我尝试重新安装 TensorFlow 时,使用
sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl is not a supported wheel on this platform.
为了在我的系统上重置 python,我什至重新安装了 Ubuntu,但这并没有太大帮助。应该怎么做才能让事情顺利进行?
【问题讨论】:
-
在 Python shell 中
print dir(tensorflow)得到什么结果?我怀疑 Python 正在从您的路径中获取不同的文件或目录 - 例如你在当前目录中有一个名为tensorflow.py的文件吗? -
@mrry 'print(dir(tensorflow))' 打印这个 '['doc', 'loader', 'name ', 'package', 'path', 'spec']'
标签: python tensorflow