环境

ubuntu:bionic的docker image

docker run -it ubuntu:bionic

python的grpc环境安装

参考grpc官网:https://grpc.io/docs/languages/python/quickstart/

# apt-get install python3-pip
# pip3 install grpcio
# pip3 install grpcio-tools Collecting grpcio
Downloading https://files.pythonhosted.org/packages/81/5e/168a7fa23a025beed6b7daa0981ace55e394a136db3082faed7d6cba4556/grpcio-1.34.1.tar.gz (21.1MB)
Collecting grpcio-tools
Downloading https://files.pythonhosted.org/packages/6b/9d/a5fa6506188e44393a225245c6898a5601caf6faa1e7093ed6af1b005fe3/grpcio-tools-1.34.1.tar.gz (2.1MB)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from grpcio)
Collecting protobuf<4.0dev,>=3.5.0.post1 (from grpcio-tools)
Downloading https://files.pythonhosted.org/packages/fe/fd/247ef25f5ec5f9acecfbc98ca3c6aaf66716cf52509aca9a93583d410493/protobuf-3.14.0-cp36-cp36m-manylinux1_x86_64.whl (1.0MB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from grpcio-tools)
Building wheels for collected packages: grpcio, grpcio-tools
Running setup.py bdist_wheel for grpcio: started
Running setup.py bdist_wheel for grpcio: still running...
Running setup.py bdist_wheel for grpcio: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/e2/60/7c/617a7c5af21a5d60c41e66ddb55f31235ec7d3f3d22d943f51
Running setup.py bdist_wheel for grpcio-tools: started
Running setup.py bdist_wheel for grpcio-tools: still running...
Running setup.py bdist_wheel for grpcio-tools: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/ee/f1/12/0bf094c3acabbb21dd495a7048e1e2bae64c8074890fc45b27
Successfully built grpcio grpcio-tools
Installing collected packages: grpcio, protobuf, grpcio-tools
Successfully installed grpcio-1.34.1 grpcio-tools-1.34.1 protobuf-3.14.0

验证

利用docker跑服务端和客户端

helloworld程序是github grpc里的示例文件,下载目录:https://github.com/grpc/grpc/tree/master/examples/python/helloworld

  1. 服务端启动
$ docker ps | grep ubuntu
be6f5b966749 ubuntu "/bin/sh -c /bin/bash" 2 hours ago Up 2 hours dazzling_margulis
$ docker exec -it be6f5b966749 sh helloworld# ls
greeter_client.py greeter_server.py
helloworld# python3 greeter_server.py
  1. 客户端启动
$ docker ps | grep ubuntu
be6f5b966749 ubuntu "/bin/sh -c /bin/bash" 2 hours ago Up 2 hours dazzling_margulis
$ docker exec -it be6f5b966749 sh helloworld# ls
greeter_client.py greeter_server.py
# python3 greeter_client.py
Greeter client received: Hello, you! <<<< 通信成功!

python的grpc环境安装的更多相关文章

  1. python新手之一环境安装

    今天开始学习python,首先环境安装 1.在https://www.python.org/downloads/下载python2.X或者3.X(ps:这里建议下载32位的python ,因为64位p ...

  2. python学习笔记1之-python简介及其环境安装

    python学习笔记之-python简介及其环境安装 最近几年python之火不用多说,最近开始利用时间自学python,在学习的过程中,按照自己的思路和理解记录下学习的过程,并分享出来,如果正好你也 ...

  3. selenium+python自动化之环境安装

    一.Python安装 1.操作系统:win7 64位系统 2.下载Python安装包,选择2.7版本和3.6版本都可以(最好安装2.7版本稳定)官网下载地址:https://www.python.or ...

  4. python+selenium自动化测试环境安装

    因为自己安装自动化测试环境时,遇到过许多问题,自己整理了一下安装的步骤,感谢那些帮助过我的人. 1.安装python,我装的是3.5版本,网络上也有许多安装步骤,照着就可以了(其实一直下一步也行) 不 ...

  5. Python系列:一、Python概述与环境安装--技术流ken

    Python简介 Python是一种计算机程序设计语言.是一种动态的.面向对象的脚本语言,最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越来越多被用于独立的.大型项 ...

  6. Python简介及环境安装

    Python 官网传送门 Python是一种面向对象的解释性计算机程序设计语言. Python 2.7将于2020年1月1日终止支持,本笔记基于Python3. pip pip 是一个现代的,通用的 ...

  7. Python系列之环境安装

    Python可以实现强大的数据爬虫功能,并且数据分析与挖掘挺方便,也提供了大量的库,比如numpy, pands,matplotlib等.尤其,使用Python做机器学习也成了近年来的趋势,有人经常会 ...

  8. python项目运行环境安装小结

    安装最新即可,实际的版本号可能不一样 安装过程较复杂,建议用一台单独的vm安装,能做成docker image最好 基础软件 nginx-1.10.0: sudo apt-get install ng ...

  9. centos 7下独立的python 2.7环境安装

    之前写过python 3.x的独立安装,相对来说比较简单直接安装即可,因为对于系统默认的python版本是2.x,那么安装3.x的时候只需要编译到新的目录即可,所有的模块都不会和之前的2有联系,但是如 ...

  10. python在windows环境安装MySQLdb

    一.环境 系统:win7,64位 python版本:2.7.15 pip版本:10.0.1 二.安装 1. 用pip安装 pip install MySQLdb 报错: Could not find ...

随机推荐

  1. AgileBoot - 项目内统一的错误码设计

    本篇文章主要探讨关于统一错误码的设计,并提供笔者的实现 欢迎大家讨论,指正. 该错误码的设计在仓库: github:https://github.com/valarchie/AgileBoot-Bac ...

  2. commons-fileupload组件和commons-io组件的详细下载

    commons-fileupload组件和commons-io组件的详细下载 1. commons-fileupload组件的下载 下载地址:http://commons.apache.org/fil ...

  3. 齐博x1第三季《模板风格的制作》系列009-自定义区块代码

    本节来说明如何自定义区块代码,不再继承上层模板,实现个性模板 上一节因为我们继承了layout布局模版,所以我们自定义的代码就无效了 如果我们继承了上层模板,那么相当于我们复制了一份上层模板的结构,也 ...

  4. 题解 CF803A Maximal Binary Matrix

    Luogu codeforces 前言 模拟赛原题.. 好好一道送分被我硬打成爆蛋.. \(\sf{Solution}\) 看了一波数据范围,感觉能 dfs 骗分. 骗成正解了. 大概就是将这个 \( ...

  5. 京东云开发者|ElasticSearch降本增效常见的方法

    Elasticsearch在db_ranking 的排名又(双叒叕)上升了一位,如图1-1所示;由此可见es在存储领域已经蔚然成风且占有非常重要的地位. 随着Elasticsearch越来越受欢迎,企 ...

  6. 【单元测试】Junit 4(四)--Junit4参数化

    1.0 前言 ​ JUnit 4引入了一项名为参数化测试的新功能.参数化测试允许开发人员使用不同的值反复运行相同的测试. 1.1 参数化设置 这里我们直接上例子吧. 题目: ​ 输入小写的字符串.如字 ...

  7. NC-日志配置及代码详解

    目录 一.日志文件输出说明 二.日志配置说明 2.1 配置文件路径 2.2 配置格式 2.2.1 参数说明 三.代码说明 四.自定义日志实例 实例1-新建日志类 实例2-直接在代码中使用日志输出 五. ...

  8. 嵌入式-C语言基础:字符串结束标识符

    #include<stdio.h> int main() { char cdata[]={'h','e','l','l','o'}; char cdata2[]="hello&q ...

  9. 833(DIV2)——C题题解

    题目链接 题目大意: 给定n个数,你可以对数值为0的数改变其为任意值,问最后前缀和为0的个数的最大值. 思路: 这题比较可惜,自己的思路没有问题,但是他少了一些东西.对数组进行前缀和处理,我们可以发现 ...

  10. day03-实现02

    实现02 3.实现任务阶段3-处理Servlet02 3.3Servlet规范设计 3.3.1MyServlet 该类模仿Servlet接口,为了简化,只声明了三个方法:init(),service( ...