No module named ‘tensorboard‘

时间:2025-04-20 10:10:24

问题描述

当运行vLLM或相关AI框架时,出现错误提示:

 ModuleNotFoundError: No module named 'tensorboard'

这表明Python环境中缺少TensorBoard库。

解决方案

1. 基础安装方法

pip install tensorboard

#或者指定版本(推荐与框架版本匹配)
pip install tensorboard==2.15.1

2. 通过conda安装(适用于conda环境)

conda install -c conda-forge tensorboard

3. 完整依赖安装

TensorBoard通常需要配合其他组件使用:

pip install tensorboard torch-tb-profiler tensorflow

验证安装

python -c "import tensorboard; print(tensorboard.__version__)"

正常应输出类似:2.15.1