擅长:python、mysql、java
<pre><code>python -m grpc_tools.protoc --proto_path=. --python_out=. --grpc_python_out=. my_proto.proto
</code></pre>
<p>编辑:</p>
<p>显然,gRPC github网站上有关于这个问题的公开问题。<code>Protoc</code>似乎与<code>grpc_python_plugin</code>存在兼容性问题?我通过安装<code>grpc_tools</code>解决了这个问题,然后使用<code>grpc_tools.protoc</code>而不是<code>protoc</code>。</p>
<pre><code>$ pip install grpcio-tools
$ pip install googleapis-common-protos
</code></pre>
<p>有用的python教程:<a href="https://grpc.io/docs/tutorials/basic/python.html" rel="nofollow noreferrer">https://grpc.io/docs/tutorials/basic/python.html</a></p>
<p><strong>见协议问题[791和4961]:</strong></p>
<ul>
<li><a href="https://github.com/google/protobuf/issues/791" rel="nofollow noreferrer">https://github.com/google/protobuf/issues/791</a></li>
<li><a href="https://github.com/grpc/grpc/issues/4961" rel="nofollow noreferrer">https://github.com/grpc/grpc/issues/4961</a></li>
</ul>