import tensorflow 出错TypeError: init() got an unexpected keyword argument 'serialized_options'
博主在import tensorflow 的时候,出现如下错误:
>>> import tensorflow as tf
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/tensorflow/init.py", line 22, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-im port
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/init.py", l ine 52, in
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/graph_p b2.py", line 15, in
from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_do t_framework_dot_node__def__pb2
File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/node_de f_pb2.py", line 15, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_ dot_framework_dot_attr__value__pb2
File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/attr_va lue_pb2.py", line 15, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_ framework_dot_tensor__pb2
File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/tensor_ pb2.py", line 15, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_ core_dot_framework_dot_resource__handle__pb2
File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/resourc e_handle_pb2.py", line 22, in
serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\nte nsorflow"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x 12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\ thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tBn\n\x1 8org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorf low/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
TypeError: init() got an unexpected keyword argument 'serialized_options'
分析原因:出现这个问题,博主认为主要以为TensorFlow版本与protobuf版本不匹配的原因。
解决办法:首先输入命令 conda list 查看你TensorFlow版本与protobuf版本,如果你使用的是tensorflow 1.8或更早版本,请使用protobuf 3.4或更早版本。博主亲测,TensorFlow1.8与protobuf3.4匹配。如果您使用的是TF 1.9或更高版本,请使用最新版本的protobuf。目前最新好像是3.6.
tensorflow 1.11.0必须要求protobuf> = 3.6.0
方法1:先卸载:
pip uninstall protobuf
重新安装protobuf:
pip install -U protobuf
方法2:
pip3 uninstall protobuf
pip3 uninstall tensorflow (卸载之前版本)
pip3 install tensorflow == 1.9.0(安装protobuf-3.6.0 tensorflow-1.5.0)
总之,TensorFlow版本与protobuf版本,必须要匹配,可以降低TensorFlow版本。亲测的版本是:TensorFlow1.9与protobuf3.6匹配。TensorFlow1.8与protobuf3.4匹配。至于其他的,可以慢慢试那种搭配合适。
import tensorflow 出错TypeError: init() got an unexpected keyword argument 'serialized_options'相关推荐
- 解决typeError: init() got an unexpected keyword argument ‘serialized_options’
解决typeError: init() got an unexpected keyword argument 'serialized_options' 问题描述:运行python文件时,手贱捣鼓了一下 ...
- TensorFlow错误:TypeError: __init__() got an unexpected keyword argument 'serialized_options'
用了好久的时间搞定了机器学习,今天想搞一搞深度学习,用TensorFlow的过程中却遇到了错误: Traceback (most recent call last):File "F:/编程/ ...
- 成功解决TypeError: __init__() got an unexpected keyword argument 'serialized_options'
成功解决TypeError: __init__() got an unexpected keyword argument 'serialized_options' 目录 解决问题 解决思路 解决方法 ...
- 【异常处理】TypeError: __new__() got an unexpected keyword argument ‘serialized_options‘
执行pointpillars的模型转时报了一个关于protobuf的错误: nvidia@nvidia-desktop:~/hive_pointpillars/second/pytorch$ pyth ...
- TensorFlow升级新版本后TypeError: __new__() got an unexpected keyword argument 'serialized_options'
环境: win7+python3.6+tensorflow 1.12 升级到1.12版本后,导入TensorFlow报错 解决办法: pip install -U protobuf
- ObjectDetecionAPI TypeError: __new__() got an unexpected keyword argument 'serialized_options'
转载地址:https://stackoverflow.com/questions/50338968/objectdetecionapi-typeerror-new-got-an-unexpected- ...
- 【Python异常】TypeError: __init__() got an unexpected keyword argument ‘size‘与gensim.models.word2vec 参数
文章目录 一.遇到的异常: 1.TypeError: __init__() got an unexpected keyword argument 'size' 2.TypeError: __init_ ...
- TypeError: __init__() got an unexpected keyword argument ‘任意数‘的原因及解决办法
本篇文章主要讲解 pymysql模块查询数据时报错 "TypeError: init() got an unexpected keyword argument '任意数'的原因及解决办法&q ...
- 已解决TypeError: __init__() got an unexpected keyword argument ‘n_iterations‘
已解决TypeError: init() got an unexpected keyword argument 'n_iterations' 文章目录 报错问题 解决方法 PS 报错问题 之前在工作中 ...
最新文章
- 分布式定时任务xxl-job的常用姿势都集齐了,So Easy!
- java linux cpu 多核 负载不均匀,系统CPU负载过高、CPU使用率不高的问题
- 在学习Python中,这个知识我们一定要看一遍,记不住没关系单一定要知道,字符串常用函数用法
- php detect unicode,php-functions/unicode.php at master · xiilei/php-functions · GitHub
- idea 分支管理插件_Git的分支管理常用命令
- Mybatis系列(四):Mybatis缓存
- asp.net中引入外部js文件,容易产生中文乱码
- VC6++配置汇编环境和第一个简单程序
- 用神经网络分类根号2与根号x的数据汇总
- yii mysql gii_yii中gii如何使用
- 使用 AppFuse 的七个理由之二
- MybatisPlus字段名为mysql保留关键字处理
- 定时器 java qua_【spring-boot】 springboot整合quartz实现定时任务
- 什么是精灵图?如何使用精灵图
- 如果编写 if 时不带 else
- 如何重新设置苹果id密码_ios游戏apple账号分享韩国苹果id密码大全
- 深度学习、目标检测情景中常见的模型评测指标
- oracle数据库测评
- MySQL数据库备份的命令
- js从一个数组中筛选出另一个数组中存在的值