Tensorflow protobuf版本报错问题解决(AttributeError: 'module' object has no attribute 'Default')
2017-09-24 21:03
2835 查看
无意中发现TF跑不了,报的错误是:
AttributeError: 'module' object has no attribute 'Default'
如下:
>>> import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/schidester/usr/tf/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/home/schidester/usr/tf/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 75, in <module> from tensorflow.core.framework.graph_pb2 import * File "/home/schidester/usr/tf/local/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 9, in <module> from google.protobuf import symbol_database as _symbol_database File "/usr/local/lib/python2.7/dist-packages/google/protobuf/symbol_database.py", line 165, in <module> _DEFAULT = SymbolDatabase(pool=descriptor_pool.Default()) AttributeError: 'module' object has no attribute 'Default'
关于这个问题,网上有各种解决方案,但是始终不对。
如pip install --upgrade protobuf等这种办法,发现这样操作之后仍旧是无效。
后来进到/usr/loca/lib/python3.6/site-packages/中才发现,里面的protobuf版本有3.2,3.4等多个版本。
没有办法,只好去看https://github.com/tensorflow/tensorflow/releases中关于protobuf的相关说明,才发现里面需要用到的tf对应的protobuf版本是3.0.0b2,
https://pypi.python.org/pypi/protobuf/3.0.0b2,从这个网站上进行下载WHL文件,再进行安装,果然顺利成功。解决该问题。
相关文章推荐
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- 解决python中问题AttributeError: 'collections.defaultdict' object has no attribute 'iteritems'
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- AttributeError: ‘module’ object has no attribute’xxx 问题解决
- TF版本问题:解决AttributeError: module 'tensorflow' has no attribute 'mul'—Jason niu
- AttributeError: 'module' object has no attribute 'Frame' 解决方法
- 关于Python的:'module' object has no attribute 'inet_pton'问题解决
- TensorFlow Bug AttributeError: module 'tensorflow' has no attribute 'unpack'
- Python3.X识别混合编码,顺便解决“AttributeError: 'module' object has no attribute 'urlopen'”
- Scrapy安装报错:AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'解决办法
- AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'seq2seq'
- 解决Pycharm中matplotlib画图出错问题(AttributeError: module 'matplotlib' has no attribute 'verbose')
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- AttributeError 'module' object has no attribute 'handlers'--Python子模块导入问题
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- 【python学习笔记(2)】脚本报错"AttributeError: 'module' object has no attribute 'xxx'"解决方法
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- 使用旧版本tensorflow出现了negative等报错的问题,AttributeError: 'module' object has no attribute 'xxx'"