Tensorboard报错:AttributeError: module ‘tensorflow‘ has no attribute ‘flags‘

本文描述了在使用Tensorboard进行可视化时遇到的AttributeError,原因在于Tensorboard和TensorFlow版本不匹配。作者提供了详细的步骤,包括检查版本、卸载不匹配的Tensorboard并重新安装对应版本来解决问题。
摘要由CSDN通过智能技术生成

问题如题,在运用Tensorboard进行可视化时,报错:AttributeError: module 'tensorflow' has no attribute 'flags'

tf.flags.DEFINE_integer(
AttributeError: module 'tensorflow' has no attribute 'flags'

解决办法:同步tensorboard版本与tensorflow版本保持一致。

做法:

1. 查看版本

pip list

2. 对比tensorboard版本与tensorflow版本是否一致

tensorboard                   2.2
tensorflow                    2.11.0

3. 如果不一致,如上图所示,先卸载tensorboard

pip uninstall tensorboard

4. 再安装与tensorflow版本一致的tensorboard

pip install tensorboard==2.11.0

5. 安装完成后测试即可

tensorboard --logdir runs

Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.11.0 at http://localhost:6006/ (Press CTRL+C to quit)

问题解决!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值