dreamlike-zzg

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ImportError: cannot import name symbol_database 

>>> import caffe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/opt/caffe/python/caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "/opt/caffe/python/caffe/io.py", line 8, in <module>
    from caffe.proto import caffe_pb2
  File "/opt/caffe/python/caffe/proto/caffe_pb2.py", line 10, in <module>
    from google.protobuf import symbol_database as _symbol_database
ImportError: cannot import name symbol_database

解决

$  apt-get install libprotobuf-dev protobuf-compiler 
Reading package lists... Done
Building dependency tree
Reading state information... Done
libprotobuf-dev is already the newest version (2.6.1-1.3).
protobuf-compiler is already the newest version (2.6.1-1.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$  pip install protobuf==2.6
# 版本要一致,caffe不支持高于3.0.0(包括它)版本的protobuf.

 

posted on 2022-11-05 15:59  梦幻济公  阅读(14)  评论(0编辑  收藏  举报