栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

新装的TensorFlow出现protobuf相关错误

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

新装的TensorFlow出现protobuf相关错误

今天刚装了个TensorFlow2.4,import tensorflow的时候,出现如下错误

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).

这是由于我们用pip安装tensorflow的时候,安装依赖包protobuf的版本过高造成的。

卸掉原来的,在重新装一个指定版本的就行了。

pip uninstall protobuf

pip install protobuf==3.19.0

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/938623.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号