Python教程

python protobuf error class DescriptorBase(metaclass=DescriptorMetaclass) SyntaxError: invalid synta

本文主要是介绍python protobuf error class DescriptorBase(metaclass=DescriptorMetaclass) SyntaxError: invalid synta,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Error

  File "/root/xxx/xxx/xxx/xxx.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/usr/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 117
    class DescriptorBase(metaclass=DescriptorMetaclass):
                                  ^
SyntaxError: invalid syntax

https://github.com/protocolbuffers/protobuf/issues/9045

解决

pip install protobuf==3.17.3

 

这篇关于python protobuf error class DescriptorBase(metaclass=DescriptorMetaclass) SyntaxError: invalid synta的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!