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

前端 未结 5 730
隐瞒了意图╮
隐瞒了意图╮ 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:16

    I use python 2.7 on windows 10.

    In my case, I have downloaded protoc-3.0.0-beta-2-win32 from https://github.com/google/protobuf/releases and copied the binary protoc file to src folder.

    after that I have run the command python setup.py build and the descriptor_pb2 was generated.

提交回复
热议问题