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

一世执手 提交于 2019-12-13 02:37:08

问题


I have a problem here which annoyed me for several days:(

I am new to python and tensorflow.

When I was practicing tensorflow and tried to use tensorboard, I met this question.

I wrote python in PyCharm and also my python version is 3.6.

part of my code is:

init = tf.global_variables_initializer()
sess = tf.Session()
writer = tf.summary.FileWriter("logs/",sess.graph) 
sess.run(init)

then, I go to terminal and write the command:

cd /Users/Claire/Library/Preferences/PyCharmCE2018.2/scratches

then, I see a directory called "logs" which has "events.out.tfevents.1533570728.H-MacBook-Air.local" in it.

So, i write a command under

/Users/Claire/Library/Preferences/PyCharmCE2018.2/scratches

tensorboard --logdir='logs/'

then, I got this error:

Traceback (most recent call last):
  File "/usr/local/bin/tensorboard", line 7, in <module>
    from tensorboard.main import run_main
  File "/usr/local/lib/python3.6/site-packages/tensorboard/main.py", line 40, in <module>
    from tensorboard import default
  File "/usr/local/lib/python3.6/site-packages/tensorboard/default.py", line 37, in <module>
    from tensorboard.plugins.audio import audio_plugin
  File "/usr/local/lib/python3.6/site-packages/tensorboard/plugins/audio/audio_plugin.py", line 30, in <module>
    from tensorboard.plugins.audio import metadata
  File "/usr/local/lib/python3.6/site-packages/tensorboard/plugins/audio/metadata.py", line 22, in <module>
    from tensorboard.plugins.audio import plugin_data_pb2
  File "/usr/local/lib/python3.6/site-packages/tensorboard/plugins/audio/plugin_data_pb2.py", line 22, in <module>
serialized_pb=_b('\n+tensorboard/plugins/audio/plugin_data.proto\x12\x0btensorboard\"}\n\x0f\x41udioPluginData\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x37\n\x08\x65ncoding\x18\x02 \x01(\x0e\x32%.tensorboard.AudioPluginData.Encoding\" \n\x08\x45ncoding\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03WAV\x10\x0b\x62\x06proto3')                   
TypeError: __init__() got an unexpected keyword argument 'serialized_options'

Can anyone help me?? Thank you.


回答1:


please uninstalle protobuf and Tensorflow, then reinstalle Tensorflow but with latest version. Apparently the version of protobuf also.

To upodate the version :

pip install -U protobuf



来源:https://stackoverflow.com/questions/51711655/python-typeerror-init-got-an-unexpected-keyword-argument-serialized-opti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!