AttributeError:“模块"对象没有属性"merge_all_summaries" [英] AttributeError: 'module' object has no attribute 'merge_all_summaries'

查看:143
本文介绍了AttributeError:“模块"对象没有属性"merge_all_summaries"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ubuntu 14.04.

Ubuntu 14.04.

Python 2.7.13 :: Anaconda自定义(64位)

Python 2.7.13 :: Anaconda custom (64-bit)

我按照教程安装了Tensorflow: https://www.tensorflow.org/install/

I installed Tensorflow follow the tutorial: https://www.tensorflow.org/install/

当我输入

〜/anaconda2/lib/python2.7/site-packages/tensorflow/examples/tutorials/mnist

~/anaconda2/lib/python2.7/site-packages/tensorflow/examples/tutorials/mnist

并尝试运行已经存在的python文件:

and attempt to run the already existed python file:

fully_connected_feed.py

fully_connected_feed.py

我遇到了以下 AttributeError :

:~/anaconda2/lib/python2.7/site-packages/tensorflow/examples/tutorials/mnist$ python fully_connected_feed.py 
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Extracting Mnist_data/train-images-idx3-ubyte.gz
Extracting Mnist_data/train-labels-idx1-ubyte.gz
Extracting Mnist_data/t10k-images-idx3-ubyte.gz
Extracting Mnist_data/t10k-labels-idx1-ubyte.gz
Traceback (most recent call last):
  File "fully_connected_feed.py", line 229, in <module>
    tf.app.run()
  File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "fully_connected_feed.py", line 225, in main
    run_training()
  File "fully_connected_feed.py", line 154, in run_training
    summary_op = tf.merge_all_summaries()
AttributeError: 'module' object has no attribute 'merge_all_summaries'

但是相同的代码可以在其他计算机上成功运行.因此,我认为这一定是我计算机中的配置问题.

But the same code run successfully in other computer. So I think that must be the configuration problem in my computer.

我已按照相同的步骤多次安装tensorflow并使用它运行了一段时间的深度学习.但这是我第一次遇到这样的问题.

I have followed the same steps to install tensorflow many times and use it to run Deep Learning for a period of time. But it was the first time I met such problem.

Google中有很多建议说这种AttributeError可能是 python版本的问题.但这不是.

There are many suggestions in Google say such kind of AttributeError maybe the problem with python version. But it's not.

推荐答案

我已经在队友的帮助下解决了这个问题.

I have solven this problem with the help of teammates.

这是 tensorflow版本问题.

Tensorflow版本为 0.12.1 .计算机中遇到AttributeError的Tensorflow版本为 1.0.0 .这个新的tensorflow版本更改了一些 Python api ,因此遇到了AttributeError.

Tensorflow version in the former computer is 0.12.1. Tensorflow version in the computer met AttributeError is 1.0.0. This new tensorflow version has change some Python api, So the AttributeError met.

在这台遇到AttributeError的计算机上:

In this computer which met AttributeError:

:~$ python
Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
>>> __tf.version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '__tf' is not defined
>>> tf.__version__
'1.0.0'
>>> 

在旧计算机上:

:~$ python
Python 2.7.13 |Anaconda 2.4.1 (64-bit)| (default, Dec 20 2016, 23:09:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
>>> tf.__version__
'0.12.1'
>>> 

这篇关于AttributeError:“模块"对象没有属性"merge_all_summaries"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆