之前代码用的好好的,然后安装了TensorRT及一系列其他包之后,原来的代码在import过程就报以下错误
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).
报该错误时,发现这些错误都是出现在mediapipe相关的导入中,跟pb2和protoc有关。
如果你也是在使用meidapipe,可以不按照报错的提示重新安装更低版本,直接卸载并重新安装mediapipe就会自动安装合适的版本。
pip install mediapipe==0.8.11