项目

一般

简介

Python protobuf

  1. 安装protobuf库
    PyYAML
    protobuf >= 3.20.x
    pip uninstall protobuf
    pip install protobuf==3.20.1
    
  2. 安装protoc内置模块
    pip install grpcio grpcio-tools
    
  3. 将.proto文件转成py文件
    python -m grpc_tools.protoc --proto_path=C:\Users\wangliuyuan\Desktop\test\ --python_out=C:\Users\wangliuyuan\Desktop\test\  --grpc_python_out=C:\Users\wangliuyuan\Desktop\test\ person.proto
    
  4. .proto文件
    syntax = "proto3";
    message Person{
        string name = 1;
        int32 age = 2;
    }
    
  5. 代码生成 查看...