已解决1.Downgrade the protobuf package to 3.20.x or lower.

已解决TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1.Downgrade the protobuf package to 3.20.x or lower. 2.Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).的正确解决方法,亲测有效!!!






报错问题





报错信息内容如下所示:

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).



报错翻译



报错信息翻译如下所示:

TypeError:无法直接创建描述符。

如果此调用来自_pb2.py文件,则生成的代码已过期,必须使用protocol>=3.19.0重新生成。

如果你不能立即再生你的原型,其他一些可能的解决方法是:

1.将protobuf包降级至3.20.x或更低。

2.设置PROTOCOL_BUFFERS_PYTHON_ECTION=PYTHON(但这将使用纯PYTHON解析,速度会慢得多)。




报错原因



报错原因:

由于版本问题,必须使用protocol>=3.19.0重新生成。

小伙伴们按下面的命令安装指定版本的protocol模块即可解决!!!




解决方法



版本protocol>=3.19.0才行:

第一步先卸载protocol模块:

pip uninstall protocol

第二步安装指定版本的protocol:

pip install protocol==3.19.0

千人全栈VIP答疑群联系博主帮忙解决报错

由于博主时间精力有限,每天私信人数太多,没办法每个粉丝都及时回复,所以优先回复VIP粉丝,可以通过订阅限时9.9付费专栏进入千人全栈VIP答疑群,获得优先解答机会(代码指导、远程服务),白嫖80G学习资料大礼包,专栏订阅地址:

    专栏福利:简历指导、招聘内推、每周送实体书、80G全栈学习视频、300本IT电子书:Python、Java、前端、大数据、数据库、算法、爬虫、数据分析、机器学习、面试题库等等 注意:如果希望得到及时回复,和大佬们交流学习,订阅专栏后私信博主进千人VIP答疑群
经验分享 程序员 微信小程序 职场和发展