Descriptors cannot not be created directly

在运行诸如深度学习python等程序时,如mmdetection、mmdetection3d中的程序,会出现报错:”Descriptors cannot not be created directly”。详细报错如下:

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.

  1. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
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).

出现这个问题的主要原因是protobuf版本不匹配。因此,按照错误提示,用pip安装对应版本的protobuf即可,如上述问题中对应的 3.20.1版本。安装命令为:

pip install protobuf==3.20.1

这个错误通常和pyQT组件版本有关,特别是在mayavi使用时会出现该错误。详细报错内容如下:

int(QtGui.QDialog.DialogCode.Accepted): OK,
AttributeError: type object 'DialogCode' has no attribute 'Accepted'

解决方式是重新安装pyqt5,即:

pip install protobuf==pyqt5

这个错误通常和pyQT组件版本有关,特别是在mayavi使用时会出现该错误。详细报错内容如下:

int(QtGui.QDialog.DialogCode.Accepted): OK,
AttributeError: type object 'DialogCode' has no attribute 'Accepted'

解决方式是重新安装pyqt5,即:

pip install protobuf==pyqt5

更多三维、二维感知算法和金融量化分析算法请关注” 乐乐感知学堂“微信公众号,并将持续进行更新。

Original: https://blog.csdn.net/suiyingy/article/details/125218783
Author: Coding的叶子
Title: Descriptors cannot not be created directly

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/669854/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球