TensorBoard 无法绑定到端口 6006,它已被使用

TensorBoard could not bind to port 6006, it was already in use

我之前已经关闭了 Tensorboard,但是在我打开新的终端并重新 运行 命令 tensorboard --logdir /tmp/retrain_logs 之后,它产生了以下错误:

E0128 12:24:08.469702 MainThread program.py:201] TensorBoard could not bind to port 6006, it was already in use

E0128 12:24:08.469702 140707008960320 program.py:201] TensorBoard could not bind to port 6006, it was already in use

ERROR: TensorBoard could not bind to port 6006, it was already in use

有人知道这怎么会发生吗?我可以轻松地重新启动 PC,但现在我正在训练我的数据集(不幸的是我还没有设置检查点)所以我不想终止它。

我不知道为什么你的 6006 端口被占用了,但你可以尝试使用另一个端口:

tensorboard --logdir=/tmp/retrain_logs  --port=8008

有时候实例结束了,端口还继续被占用

那样的话,

你可以先看看你的端口是否还被占用:

lsof -i:6006

然后,使用上面列出的 PID 终止 tcp 实例:

kill -9 PID