caffe2的编译安装非常顺利,一次成功!!!但是,当输入下面指令测试caffe2安装是否成功的时候,竟然输出Failure。
(Caffe) ubuntu@ubuntu-dell:~$ cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Failure
难以置信,好奇心驱使我看看到底出现了啥问题
(Caffe) ubuntu@ubuntu-dell:~$ python
Python 2.7.12 (default, Jan 28 2018, 16:09:54)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>from caffe2.python import core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/pytorch/build/caffe2/python/core.py", line 14, in <module>
from caffe2.proto import caffe2_pb2
File "/home/ubuntu/pytorch/build/caffe2/proto/caffe2_pb2.py", line 163, in <module>
options=None, file=DESCRIPTOR),
TypeError: __init__() got an unexpected keyword argument 'file'
一看竟然是protobuf的问题,不知道是bug还是版本问题,第一想法就是强硬一把,然后修改site-packages/protobuf-3.1.0-py2.7.egg/google/protobuf/descriper.py,将class FieldDescriptor(DescriptorBase)中初始化
500 def __init__(self, name, full_name, index, number, type, cpp_type, label,
501 default_value, message_type, enum_type, containing_type,
502 is_extension, extension_scope, options=None,
503 has_default_value=True, containing_oneof=None, json_name=None):
添加了file关键字,改为
500 def __init__(self, name, full_name, index, number, type, cpp_type, label,
501 default_value, message_type, enum_type, containing_type,
502 is_extension, extension_scope, options=None,
503 has_default_value=True, containing_oneof=None, json_name=None,file=None):
问题解决。
(Caffe) ubuntu@ubuntu-dell:~$ cd ~ && python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
Success