pip install grpcio-tools
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. route_guide.proto
result:
route_guide_pb2_grpc.py
route_guide_pb2.py
content:
classes for the messages defined in route_guide.proto
classes for the service defined in route_guide.proto
RouteGuideStub, which can be used by clients to invoke RouteGuide RPCs
RouteGuideServicer, which defines the interface for implementations of the RouteGuide service
a function for the service defined in route_guide.proto
add_RouteGuideServicer_to_server, which adds a RouteGuideServicer to a grpc.Server
note:
The 2 in pb2 indicates that the generated code is following Protocol Buffers Python API version 2.
route_guide_pb2_grpc.py
route_guide_pb2.py
Version 1 is obsolete.
It has no relation to the Protocol Buffers Language version, which is the one indicated by syntax = "proto3" or syntax = "proto2" in a .proto file.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)