繁体   English   中英

在Jupyter Notebook上导入TensorFlow 1.9.0会导致错误

[英]Importing TensorFlow 1.9.0 on Jupyter Notebook Causes an Error

我使用Anaconda Navigator安装了TensorFlow 1.12.0,当我尝试在Jupyter笔记本上导入TensorFlow 1.12.0时,仍然出现此错误:

__init__() got an unexpected keyword argument 'serialized_options'

我尝试在此处搜索类似的问题,发现的全部是安装TensorFlow 1.9.0而不是任何其他版本。 我尝试过,但没有成功。 我什至在Anaconda Navigator上创建了一个全新的环境,并在上面安装了TensorFlow 1.9.0,但仍然给了我同样的错误。 我尝试卸载整个程序并从1.9.0开始,但没有用。 我尝试了所有旧版本,但它们仍然给了我同样的错误。 有谁知道这个问题可能是什么?

这是完整的错误

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-64156d691fe5> in <module>
----> 1 import tensorflow as tf

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py in <module>
     22 
     23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
     25 
     26 try:

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\__init__.py in <module>
     57 
     58 # Protocol buffers
---> 59 from tensorflow.core.framework.graph_pb2 import *
     60 from tensorflow.core.framework.node_def_pb2 import *
     61 from tensorflow.core.framework.summary_pb2 import *

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\graph_pb2.py in <module>
     13 
     14 
---> 15 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
     16 from tensorflow.core.framework import function_pb2 as tensorflow_dot_core_dot_framework_dot_function__pb2
     17 from tensorflow.core.framework import versions_pb2 as tensorflow_dot_core_dot_framework_dot_versions__pb2

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\node_def_pb2.py in <module>
     13 
     14 
---> 15 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
     16 
     17 

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\attr_value_pb2.py in <module>
     13 
     14 
---> 15 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
     16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
     17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\tensor_pb2.py in <module>
     13 
     14 
---> 15 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
     16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
     17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\resource_handle_pb2.py in <module>
     20   syntax='proto3',
     21   serialized_options=_b('\n\030org.tensorflow.frameworkB\016ResourceHandleP\001Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\370\001\001'),
---> 22   serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\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\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
     23 )
     24 

TypeError: __init__() got an unexpected keyword argument 'serialized_options'

我也遇到过这个问题。 通过更新protobuf,我解决了错误。

请尝试以下代码进行更新,并检查问题是否解决:

点安装-U protobuf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM