@创建于:2022.09.28
@修改于:2022.09.28

1、错误信息

Traceback (most recent call last):File "D:\PycharmProjects\ner\test.py", line 15, in <module>import tensorflow as tfFile "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\__init__.py", line 37, in <module>from tensorflow.python.tools import module_util as _module_utilFile "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>from tensorflow.python.eager import contextFile "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\eager\context.py", line 29, in <module>from tensorflow.core.framework import function_pb2File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 16, in <module>from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in <module>from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in <module>from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 16, in <module>from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow\core\framework\tensor_shape_pb2.py", line 36, in <module>_descriptor.FieldDescriptor(File "D:\ProgramData\Anaconda3\envs\tf\lib\site-packages\google\protobuf\descriptor.py", line 560, in __new___message.Message._CheckCalledFromGeneratedFile()
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).More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updatesProcess finished with exit code 1

pip安装tensorflow的时候,依赖包protobuf的版本过高,4.21.6

2、解决办法

# 卸载当前版本(我的是4.21.6)
pip uninstall protobuf
# 安装低版本
pip install protobuf==3.19.0

3、参考链接

新装的TensorFlow出现protobuf相关错误

TensorFlow2.8.0报错TypeError: Descriptors cannot not be created directly.相关推荐

  1. Python报错 TypeError: Descriptors cannot not be created directly

    Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...

  2. Python报错TypeError: Descriptors cannot not be created directly

    Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...

  3. TypeError: Descriptors cannot not be created directly.

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

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

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

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

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

  6. import keras时遇到的错误 TypeError: Descriptors cannot not be created directly. If this call came from a _

    问题描述 版本对应 keras 与 tensorflow 版本对应关系:https://master–floydhub-docs.netlify.app/guides/environments/ 本文 ...

  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.解决方法

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

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

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

最新文章

  1. C++Primer学习——函数
  2. JS笔记(20): JS中的同步编程和异步编程
  3. python database ioerror_python – IOError:[Errno 2]没有这样的文件或...
  4. java环境变量自动设置_自动设置Java环境变量
  5. linux 权限拒绝,linux – 权限被拒绝,虽然文件是chmod 777
  6. java保护表格_读密码保护的工作表(版本 - Excel中95,97-2003)的Java
  7. java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal问题解决
  8. websocket 初识
  9. java char类型 unicode字符集 utf-8字符编码
  10. 支付宝小程序唤起支付
  11. 心理学当中一些很有用的定律
  12. matlab subs命令,Matlab中subs函数
  13. 深夜加油站遇到苏格拉底
  14. 记事本改字体的代码java_记事本编程切换字体颜色 用java编写一个记事本程序
  15. K8S教程(7)使用探针对容器进行健康检查
  16. 给你一部电梯,如何对其进行测试?
  17. java pdf 修改内容_Java PDFBox – 读取和修改带有特殊字符的pdf(变音符号)
  18. SAP FICO 批量成本估算
  19. 哨兵2号(Sentinel2)卫星数据处理
  20. Merkle Patricia Tree 梅克尔帕特里夏树(MPT)详细介绍

热门文章

  1. cad展点kszd小程序_CAD坐标展点脚本文件-CAD坐标展点程序下载v2 官方版-西西软件下载...
  2. 腾讯版天眼查3年VIP免费领取!下手要快
  3. 抖音推出放映厅,可以免费看电影追剧
  4. 网络安全宣传月安全团队需要知道的关于PKI的九件事
  5. Brenda-利用SOAP API访问Brenda及本地保存
  6. Java POI合并多个word文件
  7. 三维扫描仪的数据化时代
  8. 基于多层结构的网络游戏平台的研究与应用
  9. java中计算百分比
  10. 在java中如何对数组实现添加、删除和插入操作呢?