解决:TypeError: Descriptors cannot not be created directly

这篇具有很好参考价值的文章主要介绍了解决:TypeError: Descriptors cannot not be created directly。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

我使用pip命令下载安装paddlepaddle库,具体命令如下所示,采用清华镜像源,这样下载速度更快!

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddlepaddle

安装完成后,我来在python文件中导入飞浆,输出其版本号,具体如下所示:

import paddle
print(paddle.__version__)

但是,PyCharm却报错,具体报错信息如下所示:

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的版本太高而导致编译错误,所以我们只需要按照编译器提示的信息下载3.19.0对应的版本即可解决问题。
解决:TypeError: Descriptors cannot not be created directly,Python,python,开发语言
在PyCharm终端输入以下命令安装3.19.0版本的protobuf即可解决问题,具体代码如下所示:

pip install protobuf==3.19.0

下载完毕后即可正确输出paddle的版本!文章来源地址https://www.toymoban.com/news/detail-674650.html

到了这里,关于解决:TypeError: Descriptors cannot not be created directly的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

    当我们运行代码要运用到cv2库时,提示我们没有安装cv2,而直接用pip install opencv-python下载却显示下载失败: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly 直接运用conda安装: 随后完成cv2的安装。

    2024年02月10日
    浏览(26)
  • Could not build wheels for opencv-python-headless which use PEP 517 and cannot be installed directly

    笔者是python环境下安装 albumentations 出现的,该库经常用于图像增强,在cv领域有很大的知名度。在使用下边的命令进行安装后 就报了 ERROR:Could not build wheels for opencv-python-headless which use PEP 517 and cannot be installed directly 。 albumentations库依赖opencv,在直接使用pip命令安装时,albumen

    2024年02月15日
    浏览(49)
  • ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

    pip install --upgrade -r requirements.txt -i https://mirror.baidu.com/pypi/simple Looking in indexes: https://mirror.baidu.com/pypi/simple Collecting prettytable Downloading https://mirror.baidu.com/pypi/packages/5f/ab/64371af206988d7b15c8112c9c277b8eb4618397c01471e52b902a17f59c/prettytable-3.3.0-py3-none-any.whl (26 kB) Collecting ujson Downloading https://

    2024年01月22日
    浏览(49)
  • git fatal: ‘xxx‘ is not a commit and a branch ‘xxx‘ ‘ cannot be created from it

    当拉取一个git远程仓库分支时报错: 命令:git checkout -b 本地分支名 远程分支名 报错:fatal: \\\'origin/dev_v2.8.4_v10.74.1\\\' is not a commit and a branch \\\'dev_v2.8.4_v10.74.1\\\' cannot be created from it 远程新建的分支没有更新到本地。实际上,git仓库分为本地仓库和远程仓库,我们用 checkout 命令是从本

    2024年02月10日
    浏览(34)
  • 【Git报错】fatal: ‘origin/XXX‘ is not a commit and a branch ‘XXX‘ cannot be created from it

    发现问题 远程已有分支,本地需要新建对应分支,于是执行命令: git checkout --track origin/XXX 时报错。 原因: 远程真的没有这个分支,所以失败 这个情况没什么好说的 远程有这个分支,但是本地认为远程没有这个分支 执行如下命令,查看本地缓存的所有远程分支,看看你要

    2024年02月16日
    浏览(37)
  • 【已解决】moviepy视频剪辑TypeError: must be real number, not NoneType问题

    MMAction2中:基于人体姿态预测动作标签 之后显示以下消息后,表明正在构建和编写视频: 但出现以下错误提示: 通过参考网友建议: python - 每当尝试将 write_videofile 运行到 moviepy 中的剪辑时,都会出现 \\\"TypeError: must be real number, not NoneType\\\" - IT工具网 (coder.work) 最佳方式是升级

    2024年02月10日
    浏览(37)
  • git拉取远程分支到本地报错fatal: ‘origin/XXX‘ is not a commit and a branch ‘XXX‘ cannot be created from it

    远程已有分支,本地需要新建对应分支,报下面错误 原因: 远程真的没有这个分支,所以失败 远程有这个分支,但是本地认为远程没有这个分支 执行 git branch -r 命令,查看本地缓存的所有远程分支 输出显示远程并没有要拉取的分支,但是实际上远程仓库是有该分支的,从

    2024年02月15日
    浏览(35)
  • 【Python】成功解决TypeError: list indices must be integers or slices, not float

    【Python】成功解决TypeError: list indices must be integers or slices, not float 🌈 个人主页:高斯小哥 🔥 高质量专栏:Matplotlib之旅:零基础精通数据可视化、Python基础【高质量合集】、PyTorch零基础入门教程👈 希望得到您的订阅和支持~ 💡 创作高质量博文(平均质量分92+),分享更多关

    2024年04月27日
    浏览(50)
  • 【已解决】Flask项目报错TypeError: tuple indices must be integers or slices, not str

    本解决方案适用情境 :在 本地可以正常运行 的flask项目, 放到云服务器报错 TypeError: tuple indices must be integers or slices, not str,即代码本身无误的前提,可能因为环境差异导致的问题。 报错代码 TypeError: tuple indices must be integers or slices, not str 这个错误的意思是元组索引必须是整

    2024年02月17日
    浏览(32)
  • 【前端】报错TypeError: Cannot create property ‘xxx‘ on string ‘xxx‘

    报错原因分析:赋值的类型错误 前端在遍历时通过判断条件为数据添加属性时报错,在重新查看代码时发现为遍历语句错误。 for (let item in list) {} for (let item of list) {} 二者的不同之处在于,前者在遍历数组时若数组下存在属性,则会对属性也进行遍历操作,故报赋值的类型错

    2024年02月09日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包