首页 > 技术文章 > 在运行create_list.sh时候报错:AttributeError: 'module' object has no attribute 'LabelMap'

laowangxieboke 2019-01-19 22:32 原文

Traceback (most recent call last):
File "/opt/xuben-project/caffe/data/VOC0712/../../scripts/create_annoset.py", line 105, in <module>
label_map = caffe_pb2.LabelMap()
AttributeError: 'module' object has no attribute 'LabelMap'
Traceback (most recent call last):
File "/opt/xuben-project/caffe/data/VOC0712/../../scripts/create_annoset.py", line 105, in <module>
label_map = caffe_pb2.LabelMap()
AttributeError: 'module' object has no attribute 'LabelMap'

错误原因:caffe-ssd的Python环境变量未设置

解决方法:在终端执行:vim ~./bashrc

编译bashrc文件,在文件末尾添加环境变量

export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH

之后:source ~/.bashrc使设置生效,若是不行,请重启后执行source ~/.bashrc

推荐阅读