安装onnx遇到error信息:Couldn‘t build proto file

安装完onnx和onnxsim后,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).

TypeError: Couldn’t build proto file into descriptor pool: duplicate file name (onnx/onnx-ml.proto)

从提示中可以看出和protobuf相关。
解决方案:

pip uninstall protobuf
pip install --no-binary protobuf protobuf

参考:
https://stackoverflow.com/questions/68952308/tensorflow-couldnt-build-proto-file-into-descriptor-pool
https://blog.csdn.net/bailu1016/article/details/115002705

猜你喜欢

转载自blog.csdn.net/qq_39735236/article/details/125311665
今日推荐