protobuf 转换python代码时发生 Expected "required", "optional", or "repeated".错误解决方法
来源:互联网 发布:python导入自定义模块 编辑:程序博客网 时间:2024/06/01 08:31
Google Protocol Buffers 简称 Protobuf,它提供了一种灵活、高效、自动序列化结构数据的机制,可以联想 XML,但是比 XML 更小、更快、更简单。仅需要自定义一次你所需的数据格式,然后用户就可以使用 Protobuf 编译器自动生成各种语言的源码,方便的读写用户自定义的格式化的数据。与语言无关,与平台无关,还可以在不破坏原数据格式的基础上,依据老的数据格式,更新现有的数据格式。
在很多谷歌开源的程序中都大部分用到了protobuf,比如最新开源出来的object_detection中就存在这样的定义。最近想着编译一下这个目标检测识别的程序,发现protobuf居然报了个错误,错误码即如下:
.proto:386:3: Expected "required", "optional", or "repeated".
针对这个问题,才发现自己电脑上的protobuf版本是2.5版本(通过命令:protoc --version进行查看),可能原因还是新版本又更新了一些参数,查看了下需求,也发现需要用到2.6版本,所以只能重新进行编译protobuf.高的版本。
于是从https://github.com/google/protobuf/releases?after=v2.6.1下载2.6的数据包。
直接按照传统的 ./configure, make -j4 , sudo make install等方式来进行安装。
这时候还需要一个步骤,需要在/etc/profile中配置一下参数:
export LD_LIBRARY_PATH=/usr/local/lib
不然就会报如下错误:
protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object file: No such file or directory
完成安装后,再重新进行进行代码转换,即可成功。
protoc ./object_detection/protos/*.proto --python_out=.ndscbigdata@ndscbigdata-Lenovo-Product:~/work/tensorflow/models-master$
阅读全文
0 0
- protobuf 转换python代码时发生 Expected "required", "optional", or "repeated".错误解决方法
- protobuf的Required,Optional,Repeated限定修饰符
- protobuf的Required,Optional,Repeated限定修饰符
- protobuf协议的Required,Optional,Repeated限定修饰符
- protobuf的Required,Optional,Repeated限定修饰符
- protobuf的配置原始文件.proto中,使用修饰符repeated、required、optional生成的java文件的区别
- 执行make menucofig发生错误“Unable to find the ncurses libraries or the required header files”的解决方法
- 执行make menucofig发生错误“Unable to find the ncurses libraries or the required header files”的解决方法
- [Python]json对象转换出错expected string or buffer python
- java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required 错误解决方法
- python中IndentationError: expected an indented block错误的解决方法
- 错误:expected constructor, destructor, or type conversion before ‘typedef’ 的解决方法
- IE下报 Expected identifier,string or number 错误的解决方法
- 安装office2007时发生错误1706解决方法
- yum 更新时,发生错误,解决方法
- TypeError: expected string or buffer的解决方法
- error: expected ';', ',' or ')' before '&' token 解决方法
- protobuf 使用 repeated 出错
- Java 开发环境配置
- 简易版WireShark实现-相关网络知识(2)
- MFC打开文件夹选择对话框
- C语言字符串处理函数总结与实例
- Java实现Redis发布/订阅
- protobuf 转换python代码时发生 Expected "required", "optional", or "repeated".错误解决方法
- Libgdx画圆控件
- [ 转]Qt中添加OpenCV库
- 面试题总结1
- java解析URL
- 车辆牌照字符识别——matlab
- linux报错之--->export `=' not a valid identifier的一般原因
- Nginx配置详解
- 解决Linux下启动Tomcat遇到Neither the JAVA_HOME nor the JRE_HOME environment variable is defined