2024-10-01 07:42:15 发布
网友
我已经在gRPC写了一个服务。启动服务时,它无法导入已编译的protobuf,并显示以下错误消息:
from google.protobuf import descriptor as _descriptortitus| ModuleNotFoundError: No module named 'google'
试图重现你的问题
我的配置也很好
看起来在pip中有multiple{}个包。 还有一个名为google的软件包实际上不是谷歌的官方软件包。 你用pip install google安装谷歌软件包了吗
pip
google
pip install google
我是这样做的
pip install protobuf
pip freeze
protobuf==3.13.0 six==1.15.0
from google.protobuf import descriptor dir(descriptor)
['Descriptor', 'DescriptorBase', 'DescriptorMetaclass', 'EnumDescriptor', 'EnumValueDescriptor', 'Error', 'FieldDescriptor', 'FileDescriptor', 'MakeDescriptor', 'MethodDescriptor', 'OneofDescriptor', 'ServiceDescriptor', 'TypeTransformationError', '_Deprecated', '_Lock', '_NestedDescriptorBase', '_OptionsOrNone', '_ParseOptions', '_ToCamelCase', '_ToJsonName', '_USE_C_DESCRIPTORS', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_internal_create_key', '_lock', '_message', 'api_implementation', 'binascii', 'os', 'six', 'threading', 'warnings']
我的python版本是
Python 3.6.7 (default, Dec 5 2018, 15:02:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information.
试图重现你的问题
我的配置也很好
看起来在}个包。
pip
中有multiple{还有一个名为
google
的软件包实际上不是谷歌的官方软件包。你用
pip install google
安装谷歌软件包了吗我是这样做的
我的python版本是
相关问题 更多 >
编程相关推荐