使用protobuf报错如下:
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
解决方案:
1. 查看protoc的版本,在命令行输入如下代码:
protoc --version
2. 查看protobuf版本:
pip show protobuf
如果两个版本不一致,那么请将两个的版本保持到一致。
可以使用如下pip安装命令对protobuf升级:
pip install --upgrade protobuf -i https://pypi.douban.com/simple
也可以到https://github.com/protocolbuffers/protobuf/releases,下载合适版本的protoc