关于tensorboard --logdir=logs的报错解决办法记录

我在运行tensorboard --logdir=logs时,产生了如下的报错,找遍全网后,解决办法如下
关于tensorboard --logdir=logs的报错解决办法记录_第1张图片
先卸载

pip uninstall tensorboard

再安装

pip install tensorboard

最后出现如下报错

Traceback (most recent call last):
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\compat_init_.py”, line 42, in tf
from tensorboard.compat import notf # noqa: F401
ImportError: cannot import name ‘notf’ from ‘tensorboard.compat’ (d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\compat_init_.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “d:\newanaconda\envs\imooc_aiai\lib\runpy.py”, line 194, in run_module_as_main
return run_code(code, main_globals, None,
File “d:\newanaconda\envs\imooc_aiai\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "D:\newanaconda\envs\imooc_aiai\Scripts\tensorboard.exe_main
.py", line 7, in
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\main.py”, line 39, in run_main
main_lib.global_init()
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\main_lib.py”, line 40, in global_init
if getattr(tf, “version”, “stub”) == “stub”:
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\lazy.py”, line 65, in getattr
return getattr(load_once(self), attr_name)
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\lazy.py”, line 97, in wrapper
cache[arg] = f(arg)
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\lazy.py”, line 50, in load_once
module = load_fn()
File "d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorboard\compat_init
.py", line 45, in tf
import tensorflow
File "d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow_init
.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\python_init
.py", line 40, in
from tensorflow.python.eager import context
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\python\eager\context.py”, line 32, in
from tensorflow.core.framework import function_pb2
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\core\framework\function_pb2.py”, line 16, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py”, line 16, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\core\framework\tensor_pb2.py”, line 16, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py”, line 16, in
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File “d:\newanaconda\envs\imooc_aiai\lib\site-packages\tensorflow\core\framework\tensor_shape_pb2.py”, line 36, in
_descriptor.FieldDescriptor(
File “d:\newanaconda\envs\imooc_aiai\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).

解决办法

 pip install protobuf==3.19.0 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

关于tensorboard --logdir=logs的报错解决办法记录_第2张图片
最后成功
关于tensorboard --logdir=logs的报错解决办法记录_第3张图片

你可能感兴趣的:(深度学习,python,tensorflow,开发语言)