Why do I see “cannot import name descriptor_pb2” error when using Google Protocol Buffers?

前端 未结 5 714
隐瞒了意图╮
隐瞒了意图╮ 2021-01-18 03:51

When using the generated Python code from our protobuf classes, we get this error:

cannot import name descriptor_pb2

The equivalent C++ gen

5条回答
  •  独厮守ぢ
    2021-01-18 04:15

    Please make sure to install the protobuf runtime library as directed in the readme file. You cannot simply use the source directly out of the package, since descriptor_pb2.py needs to be generated by protoc (the protobuf compiler) as part of the installation process.

提交回复
热议问题