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


    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

     log

    # pip install protobuf==3.17.3
    Collecting protobuf==3.17.3
      Downloading https://files.pythonhosted.org/packages/d5/e0/20ba06eb42155cdb4c741e5caf9946e4569e26d71165abaecada18c58603/protobuf-3.17.3-py2.py3-none-any.whl (173kB)
        100% |################################| 174kB 1.2MB/s
    Collecting six>=1.9 (from protobuf==3.17.3)
      Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
    Installing collected packages: six, protobuf
      Found existing installation: protobuf 4.21.1
        Uninstalling protobuf-4.21.1:
          Successfully uninstalled protobuf-4.21.1
    Successfully installed protobuf-3.17.3 six-1.16.0
  • 相关阅读:
    Spring boot mybatis : Error creating bean with name 'com.github.pagehelper.autoconfigure.MapperAutoConfiguration': Invocation of init method failed;
    方法调用
    初识MQ
    Shell 变量
    Eclipse 导入本地 Git 项目
    IDEA 常用快捷键
    Xshell 配色方案
    冒泡排序
    递归
    安卓服务Service详解
  • 原文地址:https://www.cnblogs.com/Primzahl/p/16392682.html
Copyright © 2020-2023  润新知