我试图定义自己的消息代表我想要序列化的python类 . 但是,我需要在.proto文件中导入any.proto或timestamp.proto来表示某些消息
syntax = "proto3";
import "/google/protobuf/any.proto";
message Test {
google.protobuf.Any var1 = 1;
}
但是,似乎protobuf安装没有任何.proto文件 . 我正在使用python 3.5并安装了protobuf 3.5.2 . 我试着查看我的网站包,即 site-packages/google/protobuf/
,并且没有* .proto文件,但只找到了编译文件,如 ant_pb2.py
和 timestamp_pb2.py
. 我在这里按照文档导入 any.proto
- https://developers.google.com/protocol-buffers/docs/proto3#any