我使用anaconda发行版安装了 tensorflow ,我无法在python中使用相同的内容。
当我使用Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB2\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
导入tensorflow时,出现以下错误:
protobuf
我尝试重新安装anaconda以及卸载nodeState = [2 8 5; 1 6 4; 9 0 5];
cState = [];
cState = [nodeState(1,1) nodeState(1,2) nodeState(1,3)
nodeState(2,3) nodeState(3,3) nodeState(3,2)
nodeState(3,1) nodeState(2,1) nodeState(2,2)];
,我在stackoverflow中的某处找到了答案。
答案 0 :(得分:0)
您也应该卸载tensorflow,并确保卸载了protobuf。您也可以尝试brew uninstall protobuf
。然后重新安装protobuf和tensorflow。 Tensorflow需要protobuf版本3.x
pip install 'protobuf>=3.0.0a3'
您可以测试您的protobuf版本:
import google.protobuf
>>> print google.protobuf.__version__