我无法传递pytest并且无法在python中导入caffe。
caffe在直接\ Documents
当我导入caffe时,会跟随结果。
>>> import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/james/Documents/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/james/Documents/caffe/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/Users/james/Documents/caffe/python/caffe/io.py", line 8, in <module>
from caffe.proto import caffe_pb2
File "/Users/james/Documents/caffe/python/caffe/proto/caffe_pb2.py", line 23, in <module>
1a\n\x0f\x64\x65t_context_pad\x18: \x01(\r:\x01\x30\x12\x1b\n\rdet_crop_mode\x18; \x01(\t:\x04warp\x12\x12\n\x07new_num\x18< \x01(\x05:\x01\x30\x12\x17\n\x0cnew_channels\x18= \x01(\x05:\x01\x30\x12\x15\n\nnew_height\x18> \x01(\x05:\x01\x30\x12\x14\n\tnew_width\x18? \x01(\x05:\x01\x30\x12\x1d\n\x0eshuffle_images\x18@ \x01(\x08:\x05\x66\x61lse\x12\x15\n\nconcat_dim\x18\x41 \x01(\r:\x01\x31\x12\x36\n\x11hdf5_output_param\x18\xe9\x07 \x01(\x0b\x32\x1a.caffe.HDF5OutputParameter\".\n\nPoolMethod\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02\"W\n\x0ePReLUParameter\x12&\n\x06\x66iller\x18\x01 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x1d\n\x0e\x63hannel_shared\x18\x02 \x01(\x08:\x05\x66\x61lse*\x1c\n\x05Phase\x12\t\n\x05TRAIN\x10\x00\x12\x08\n\x04TEST\x10\x01')
TypeError: __init__() got an unexpected keyword argument 'syntax'
我不知道什么是错的。
答案 0 :(得分:0)
这看起来像protobuf的一个问题 - https://github.com/BVLC/caffe/issues/2092
你安装了protobuf 3.0吗?您可能需要回滚到2.6。
您还可以统一python protobuf和protoc
的版本