Tensorboard 打不开图,或者命令行运行出错解决方案
参考:
我在使用
t
e
n
s
o
r
b
o
a
r
d
tensorboard
tensorboard 的时候出现了一些问题,首先是
t
e
n
s
o
r
b
o
a
r
d
tensorboard
tensorboard 运行正常,
e
v
e
n
t
s
events
events 文件也存在,但是找不到图,如图所示:

这可能是我的命令行输入有问题,我的输入是
tensorboard --logdir='logs'
这里是不需要引号的。。。
修改后:
tensorboard --logdir=logs
B u t ! But! But! 出现了新的问题:
TypeError:GetNext() takes 1 positional argument but 2 were given
如图所示:

参考了
G
i
t
h
u
b
Github
Github 上的解决方案:
这里需要安装
t
b
−
n
i
g
h
t
l
y
tb-nightly
tb−nightly 包
S
o
.
.
.
So...
So...
pip install tb-nightly
你以为这样就行了?
T
o
o
y
o
u
n
g
t
o
o
n
a
i
v
e
!
Too~young~too~naive!
Too young too naive!
出现了这个问题:
AttributeError: module 'tensorflow.estimator' has no attribute 'SessionRunHook'
这酸爽。。。堪比老坛酸菜。。。
继续
G
i
t
h
u
b
Github
Github 上找答案,但是没找到,最后参考了别人其它问题的解决办法
- 删除 s i t e − p a c k a g e s site-packages site−packages 文件夹下的 t e n s o r b o a r d tensorboard tensorboard 文件夹
- 重新安装 t e n s o r b o a r d tensorboard tensorboard 匹配的版本
第二步我说一下,我是按照别人的方法安装了指定版本,但是安装完成以后提示和 t e n s o r f l o w tensorflow tensorflow 版本不匹配,但是这时候 t e n s o r b o a r d tensorboard tensorboard 是可以正常使用了的,为了避免潜在的后续麻烦,我重新安装了匹配的版本,这时候发现是可以正常使用的。这个版本和我最初的版本是同一版本。。。
pip install tensorboard==1.9.0
综上,解决 t e n s o r b o a r d tensorboard tensorboard 不能正常使用的问题,可以从以下几个角度入手
- 如果命令行正常运行,图打不开,这时候检查一下目录下是否有数据文件
e
v
e
n
t
s
events
events
文件存在的话,查一下命令行运行环境是否和文件在同一磁盘下, w i n win win 系统下要 c d cd cd 到同一路径
如果图找不到而且命令行做出提示,尝试更换浏览器,不要以为谷歌浏览器一定能打开,尝试一下其他浏览器,比如火狐 - 如果命令行运行出现错误:
查看安装的 t e n s o r f l o w tensorflow tensorflow 和 t e n s o r b o a r d tensorboard tensorboard 是否为同一版本,如果不是,卸载旧版,安装匹配的版本,查看安装的包使用
pip list
如果仍然没有解决,可能就是和我的问题一样了,尝试以下步骤:
- 删除 s i t e − p a c k a g e s site-packages site−packages 文件夹下的 t e n s o r b o a r d tensorboard tensorboard 文件夹
- 重新安装 t e n s o r b o a r d tensorboard tensorboard 匹配的版本
终极解决方案:
- 卸载 t e n s o r f l o w tensorflow tensorflow、 t e n s o r b o a r d tensorboard tensorboard
- 安装最新版本 t e n s o r f l o w tensorflow tensorflow、 t e n s o r b o a r d tensorboard tensorboard
这一种方案不到万不得已不推荐使用,因为太麻烦了,可能发生各种依赖包版本不兼容问题,就像 P C PC PC 一故障就重装系统一样,饮鸩止渴的方法,问题不一定得到解决,还可能导致更多的问题。