我在ubuntu中使用grpc,在导入run_codegen.sh生成的* _pb2.py时,我得到了以下ImportError:
raceback (most recent call last):
File "q_db_op.py", line 2, in <module>
import db_op_pb2
File "/data/server/grpc/db_op_pb2.py", line 331, in <module>
from grpc.early_adopter import implementations
File "/usr/local/lib/python2.7/dist-packages/grpc/early_adopter/implementations.py", line 34, in <module>
from grpc._adapter import fore as _fore
File "/usr/local/lib/python2.7/dist-packages/grpc/_adapter/fore.py", line 38, in <module>
from grpc._adapter import _intermediary_low as _low
File "/usr/local/lib/python2.7/dist-packages/grpc/_adapter/_intermediary_low.py", line 57, in <module>
from grpc._adapter import _low
File "/usr/local/lib/python2.7/dist-packages/grpc/_adapter/_low.py", line 31, in <module>
from grpc._adapter import _c
ImportError: /usr/local/lib/python2.7/dist-packages/grpc/_adapter/_c.so: undefined symbol: grpc_google_iam_credentials_create
我们将不胜感激。
答案 0 :(得分:3)
这有点像你只安装了gRPC Python并且还没有在你的系统上安装gRPC Core。如果是这种情况,问题的解决方案是安装gRPC Core(“sudo apt-get install libgrpc-dev”,请参阅installation instructions)。
还要注意你安装的gRPC Core版本(0.11,0.12或更高版本)与你安装的grpcio PyPI软件包的版本相同(0.11,0.12或者其他东西)更高版本)。