python安装grpc

pip install grpcio
pip install grpcio-tools googleapis-common-protos

下载速度慢可以在后面加上参数指定清华源-i http://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

问题预警:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from client import Client
  File "/root/api/client.py", line 8, in <module>
    from com.core.common.net import port_pb2, address_pb2
  File "/root/api/com/core/common/net/port_pb2.py", line 5, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder'

解决方案:更新 protobuf pip install --upgrade protobuf

posted @ 2023-03-14 14:48  Désiré  阅读(308)  评论(0)    收藏  举报