SyntaxError:导入caffe时与protobuf相关的语法无效

时间:2018-07-06 00:36:55

标签: deep-learning protocol-buffers pycaffe matcaffe

我已经安装了caffe并成功构建了pycaffe。但是,一旦我要导入它,它就会显示与protobuf相关的错误:

>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "caffe/io.py", line 8, in <module>
    from caffe.proto import caffe_pb2
  File "caffe/proto/caffe_pb2.py", line 9, in <module>
    from google.protobuf import reflection as _reflection
  File "/home/user/.local/lib/python2.7/site-packages/google/protobuf/reflection.py", line 70, in <module>
    from google.protobuf.internal import python_message
  File "/home/user/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 82, in <module>
    from google.protobuf import text_format
  File "/home/user/.local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 630
    if o == 10: return rb"\n"   # optional escape
                            ^
SyntaxError: invalid syntax

我已经编译了protobuf源代码,并且安装路径的配置是默认路径,并且已经将该路径导出到.bashrc export LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}中。问题出在哪里?

0 个答案:

没有答案