在Ubuntu 15.10,Cuda 7.5,cudnn 4.0,python 2.7上从源代码构建了tensorflow 0.7。 Bazel构建和pip包生成OK。 pip安装好。 Python脚本"导入tensorflow"失败:
Traceback (most recent call last):
File "/home/keith/Desktop/tf1.py", line 8, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 35, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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(\tB/\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
有什么想法? 感谢
答案 0 :(得分:0)
这看起来像protobuf库版本控制错误。这里有类似问题的长线程: https://github.com/tensorflow/tensorflow/issues/11 接近尾声有一些建议的解决方案可能有所帮助。
答案 1 :(得分:0)
我通过使用optirun运行python,使用cuda加速在manjaro linux笔记本电脑上运行TensorFlow 0.7成功:
$optirun python
然而,我有protobuf的问题,我不得不卸载/重新安装以前版本的protobuf和tensorflow与pip。 http://bit.ly/1RHApU5
答案 2 :(得分:0)
这是因为protobuf版本冲突: 对我来说,我从apt-get包管理器安装了python-protobuf v2.6.1 安装tensorflow时,它从pip manager
安装了protobuf v3.3.0所以我卸下了两个:
sudo pip uninstall protobuf
sudo apt-get remove python-protobuf
使用pip重新安装,它解决了问题!!!
sudo pip install protobuf
希望这会有所帮助..