报错信息
TypeError: Descriptors cannot not be created directly.
解决办法
尝试把远程的protobuf版本降级到3.19.0,
- 使用命令
pip show protobuf发现版本是4.21.6 - 卸载高版本的protobuf
pip uninstal protobuf - 安装新版本的protobuf
pip install protobuf==3.19.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
安装时发现报错,但是不影响正常使用,报错大致是因为 grpcio-tools 需要较高版本的protobuf