我在Mac OS x上安装了源代码中的caffe,但是当我输入此命令时:
python -c "import caffe"
我收到了这个错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/io.py", line 8, in <module>
from caffe.proto import caffe_pb2
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/proto/caffe_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/descriptor.py", line 46, in <module>
from google.protobuf.pyext import _message
ImportError: dlopen(/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so, 2): Symbol not found: __ZNK6google8protobuf10TextFormat17FieldValuePrinter10PrintBytesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Referenced from: /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
Expected in: flat namespace
in /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
任何建议将不胜感激:) 提前致谢
答案 0 :(得分:0)
确保Python路径指向$ CAFFE_HOME / Python