好程序员Python 培训分享 Python 配置 gRPC 环境, gRPC 是一款高性能、开源的 RPC 框架,产自 Google ,基于 ProtoBuf 序列化协议进行开发,支持多种语言 (Golang 、 Python 、 Java 等 ) ,本篇文章 给读者们简单介绍一下 Python 配置 gRPC 环境及 Python 的 gRPC 安装使用,感兴趣的小伙伴就随小来了解一下吧。
gRPC 的安装:
$ pip install grpcio
安装ProtoBuf 相关的 python 依赖库:
$ pip install protobuf
安装python grpc 的 protobuf 编译工具:
$ pip install grpcio-tools
测试:
// 源码路径 https://github.com/grpc/grpc
git clone https://github.com/grpc/grpc
cd grpc/examples/python/helloworld
python greeter_server.py // 一个常驻服务
// 启动客户端访问 server
python greeter_client.py
// 打印 Greeter client received: Hello, you! 即为可以使用
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69913864/viewspace-2737307/ ,如需转载,请注明出处,否则将追究法律责任。