不用担心,因为proto2和proto3生成的代码都是_pb2.py这个后缀。这个后缀只是为了区分开proto1(只在Google内部使用)。
生成python代码的命令行:
protoc --proto_path=src --python_out=build/gen src/foo.proto src/bar/baz.proto
参见谷歌官方文档
Currently both proto2 and proto3 use _pb2.py for their generated files.