已解决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.1.0If 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_BUPFERS_PYTHON_iMPLEMENTATION=python (but this will use pure-Python parsing and will be mch slower ,More information: https://developers. google.com/protocol-buffers/docs/news/2022-05-06#python-updates
(paddle) F: \pycharm\PyCharm Community Edition 2022.1.4\bin\PaddleOCR-release-2.6\PPOCRLabe1>-


文章目录

  • 报错代码
  • 报错翻译
  • 报错原因
  • 解决方法
  • 帮忙解决

报错代码

粉丝群一个小伙伴想要安装一个PPOCRLabel,pip里已经把paddlepaddle和paddleorc下好了,然后输入PPOCRLabel --lang ch
,但是还是发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个bug不会解决的小伙伴),报错代码如下:

报错信息内容如下

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.1.0If 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_BUPFERS_PYTHON_iMPLEMENTATION=python (but this will use pure-Python parsing and will be mch slower ,More information: https://developers. google.com/protocol-buffers/docs/news/2022-05-06#python-updates
(paddle) F: \pycharm\PyCharm Community Edition 2022.1.4\bin\PaddleOCR-release-2.6\PPOCRLabe1>-

报错翻译

报错信息翻译如下

类型错误:无法直接创建描述符。
如果此调用来自_pb2.py文件,则生成的代码已过期,必须使用protoc>=3.1.0重新生成。如果无法立即重新生成protos,则其他一些可能的解决方法如下:

  • 将protobuf包降级至3.20.x或更低。
  • 设置PROTOCOL_BUPFERS_PYTHON_iMPLEMENTATION=PYTHON(但这将使用纯PYTHON解析,速度会慢很多,更多信息:https://developers.google.com/protocolbuffers/docs/news/2022-05-06#python更新(桨板)F:\pycharm\pycharm社区版2022.1.4\bin\PidleOCR-release-2.6\PPOCRabe1>

报错原因

报错原因

仔细阅读报错信息就会发现,报错的主要原因是因为protobuf的版本太高而导致编译错误,所以我们只需要按照编译器提示的信息下载3.19.0对应的版本即可解决问题。小伙伴按下面的代码安装指定版本即可!!!

解决方法

执行下面的pip安装命令即可:

pip install protobuf==3.19.0

或者:

pip install 'protobuf~=3.19.0'

帮忙解决

本文已收录于:《告别Bug》专栏

本专栏用于记录学习和工作中遇到的各种疑难Bug问题,以及粉丝群里小伙伴提出的各种问题,文章形式:报错代码 + 报错翻译 + 报错原因 + 解决方法,包括程序安装、运行程序过程中等等问题,订阅专栏+关注博主后如遇到其他问题可私聊帮忙解决!!!

已解决TypeError: Descriptors cannot not be created directly.相关推荐

  1. 解决TypeError: Descriptors cannot not be created directly报错!

    完整报错如下: TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file ...

  2. 问题:TypeError: Descriptors cannot not be created directly.解决方法

    运行代码时提示如下报错: 解决上面问题,直接在控制台中输入下面命令重新安装protobuf即可,如下: pip install 'protobuf~=3.19.0' 以上就是解决TypeError: ...

  3. python报错系列一:TypeError: Descriptors cannot not be created directly.

    解决TypeError: Descriptors cannot not be created directly. pip install protobuf==3.19.0 或者 pip install ...

  4. TypeError: Descriptors cannot not be created directly解决

    文章目录 问题 解决 问题 跑代码的时候遇到了这个问题: TypeError: Descriptors cannot not be created directly. If this call cam ...

  5. 【TypeError: Descriptors cannot not be created directly. 】解决方法

    报错信息: TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.pyfile, y ...

  6. python TypeError: Descriptors cannot not be created directly错误解决

    运行python脚本时出现错误 TypeError: Descriptors cannot not be created directly. If this call came from a _pb2 ...

  7. 解决:TypeError: Descriptors cannot not be created directly

    我使用pip命令下载安装paddlepaddle库,具体命令如下所示,采用清华镜像源,这样下载速度更快! pip install -i https://pypi.tuna.tsinghua.edu.c ...

  8. TypeError: Descriptors cannot not be created directly.

    python 依赖 protobuf 奇怪报错 TypeError: Descriptors cannot not be created directly. 在使用 paddlex 时引入一些调用了 ...

  9. TensorFlow2.8.0报错TypeError: Descriptors cannot not be created directly.

    @创建于:2022.09.28 @修改于:2022.09.28 1.错误信息 Traceback (most recent call last):File "D:\PycharmProjec ...

最新文章

  1. docker-compose 安装mysql
  2. Android: how to resolve Application’s parameter NullPointerException
  3. python导入xlsx文件-python怎么用pd导入xlsx
  4. 每日 30 秒 ⏱ HTML Cosplay
  5. C#使用TCP/IP与ModBus进行通讯
  6. python实现数据恢复软件_pyinstaller还原python代码过程图解
  7. 高中计算机教师考试专业知识,高中教师资格证计算机专业考试内容
  8. pcb成型板aoi检测_通过自动光学检测(AOI)实现PCB高速检测
  9. 什么是云存储网关CSG
  10. linux怎样卸载conda,【原创文章】生信软件环境conda的安装与卸载
  11. FragmentActivity和Activity的区别
  12. phtread条件变量pthread_cond_t初始化方式
  13. 谷歌浏览器html播放音乐,谷歌浏览器听歌插件:用Listen1听歌超方便!‖干货大放送...
  14. js 小写金额转大写金额
  15. 个人知乎 ##功能一-登录注册
  16. 连接数据库查询数据的工具类(底层实现)——以查询Phoenix为例
  17. View是什么,什么是View?
  18. 佛山机场安装RFID行李跟踪系统 可全流程追踪行李
  19. 先验概率、后验概率、似然估计三者的区别与联系
  20. mysql语句优化总结(一)

热门文章

  1. [Jule CTF 2022] 部分WP
  2. 2D骨骼动画工具DragonBones的使用教程
  3. 欢迎高校选修云创大数据免费在线直播课!
  4. 一对一视频直播系统开源一对一视频交友源码程序
  5. Dependency ‘org.mybatismybatisx.x.x‘ not found问题解决方法
  6. 计算机使用计数制是,进位计数制
  7. Linux系统SCSI磁盘扫描机制解析及命令实例
  8. 第15课:如何用RPA循环填写表单?(练兵场二)
  9. cannot find -lxxx
  10. 艰涩难懂,不存在的,消息队列其实很简单