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).
在跑python代码的时候遇到了上述问题。
只需在终端运行:
pip uninstall protobuf
pip install protobuf==3.19.0
即可解决。
当无法立即重新生成protos时,可以考虑降级protobuf包到3.20.x或更低版本,或者设置环境变量PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION为python,但后一种方法将使用纯Python解析,速度会显著变慢。通过运行‘pipuninstallprotobuf’和‘pipinstallprotobuf==3.19.0’可以在终端快速解决此问题。
1313






