TensorFlow2.8.0报错TypeError: Descriptors cannot not be created directly.
@创建于: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.相关推荐
- Python报错 TypeError: Descriptors cannot not be created directly
Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...
- Python报错TypeError: Descriptors cannot not be created directly
Python报错TypeError: Descriptors cannot not be created directly 具体错误: TypeError: Descriptors cannot no ...
- TypeError: Descriptors cannot not be created directly.
python 依赖 protobuf 奇怪报错 TypeError: Descriptors cannot not be created directly. 在使用 paddlex 时引入一些调用了 ...
- 解决TypeError: Descriptors cannot not be created directly报错!
完整报错如下: TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file ...
- python报错系列一:TypeError: Descriptors cannot not be created directly.
解决TypeError: Descriptors cannot not be created directly. pip install protobuf==3.19.0 或者 pip install ...
- 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/ 本文 ...
- 解决:TypeError: Descriptors cannot not be created directly
我使用pip命令下载安装paddlepaddle库,具体命令如下所示,采用清华镜像源,这样下载速度更快! pip install -i https://pypi.tuna.tsinghua.edu.c ...
- 问题:TypeError: Descriptors cannot not be created directly.解决方法
运行代码时提示如下报错: 解决上面问题,直接在控制台中输入下面命令重新安装protobuf即可,如下: pip install 'protobuf~=3.19.0' 以上就是解决TypeError: ...
- 【TypeError: Descriptors cannot not be created directly. 】解决方法
报错信息: TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.pyfile, y ...
最新文章
- C++Primer学习——函数
- JS笔记(20): JS中的同步编程和异步编程
- python database ioerror_python – IOError:[Errno 2]没有这样的文件或...
- java环境变量自动设置_自动设置Java环境变量
- linux 权限拒绝,linux – 权限被拒绝,虽然文件是chmod 777
- java保护表格_读密码保护的工作表(版本 - Excel中95,97-2003)的Java
- java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal问题解决
- websocket 初识
- java char类型 unicode字符集 utf-8字符编码
- 支付宝小程序唤起支付
- 心理学当中一些很有用的定律
- matlab subs命令,Matlab中subs函数
- 深夜加油站遇到苏格拉底
- 记事本改字体的代码java_记事本编程切换字体颜色 用java编写一个记事本程序
- K8S教程(7)使用探针对容器进行健康检查
- 给你一部电梯,如何对其进行测试?
- java pdf 修改内容_Java PDFBox – 读取和修改带有特殊字符的pdf(变音符号)
- SAP FICO 批量成本估算
- 哨兵2号(Sentinel2)卫星数据处理
- Merkle Patricia Tree 梅克尔帕特里夏树(MPT)详细介绍