ImportError:无法导入名称' SummaryWriter'

时间:2018-04-25 10:13:26

标签: python python-3.x nlp tensorboard

任何人都可以帮我解决此错误,我正在尝试使用allennlp模型并获得以下错误。

 from allennlp.training.metrics import Average, BooleanAccuracy, 
 CategoricalAccuracy
 File "/home/administrator/aman/venv-kbs/lib/python3.6/site- 
 packages/allennlp/training/__init__.py", line 3, in <module>
 from allennlp.training.trainer import Trainer
 File "/home/administrator/aman/venv-kbs/lib/python3.6/site- 
 packages/allennlp/training/trainer.py", line 21, in <module>
 from tensorboard import SummaryWriter
 ImportError: cannot import name 'SummaryWriter'

请在下面找到随版本一起安装的软件包。

tensorboard             1.0.0a6
tensorboard-pytorch     0.7.1
tensorboardX            0.8
tensorflow              1.4.0
tensorflow-tensorboard  0.4.0

1 个答案:

答案 0 :(得分:1)

from tensorboard import SummaryWriter更改为from tensorboardX import SummaryWriter