导入tensorflow时出现EnumDescriptorProto错误

时间:2017-11-19 04:32:49

标签: python tensorflow

我试图运行以下代码

import tensorflow as tf

print("Hello TensorFlow version", tf.__Version__)

发出以下错误

  

用户/安纳康达/ ENVS / CNN / bin中/蟒   /Users/Downloads/rude-carnie/version.py Traceback(最近的电话   last):文件“/Users/Downloads/rude-carnie/version.py”,第1行,in   将tensorflow导入为tf文件   “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/init.py”   第24行,来自tensorflow.python import *文件   “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/python/init.py”   第52行,来自tensorflow.core.framework.graph_pb2 import *文件   “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py”   第10行,来自google.protobuf import descriptor_pb2文件   “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/google/protobuf/descriptor_pb2.py”   第735行,选项=无,文件= DESCRIPTOR),文件   “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/google/protobuf/descriptor.py”   第501行,在新的回报中   _message.default_pool.FindFieldByName(full_name)KeyError:“找不到字段   google.protobuf.EnumDescriptorProto.EnumReservedRange.start“

我怎样才能解决这个问题?

1 个答案:

答案 0 :(得分:1)

Today I came across same problem. Uninstall all the protobuf on your machine (both from anaconda and pip)

num

install protobuf using pip:

pip uninstall protobuf
conda remove protobuf

Source : https://github.com/tensorflow/tensorflow/issues/14689