栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【问题解决】AttributeError: module ‘tensorflow‘ has no attribute ‘io‘

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【问题解决】AttributeError: module ‘tensorflow‘ has no attribute ‘io‘

from torch.utils.tensorboard import SummaryWriter

遇到报错:

File "D:anaconda3envspytorch_py37libsite-packagestorchutilstensorboardwriter.py", line 220, in __init__
    self._get_file_writer()
  File "D:anaconda3envspytorch_py37libsite-packagestorchutilstensorboardwriter.py", line 251, in _get_file_writer
    self.flush_secs, self.filename_suffix)
  File "D:anaconda3envspytorch_py37libsite-packagestorchutilstensorboardwriter.py", line 61, in __init__
    log_dir, max_queue, flush_secs, filename_suffix)
  File "D:anaconda3envspytorch_py37libsite-packagestensorboardsummarywriterevent_file_writer.py", line 72, in __init__
    tf.io.gfile.makedirs(logdir)
  File "D:anaconda3envspytorch_py37libsite-packagestensorboardlazy.py", line 65, in __getattr__
    return getattr(load_once(self), attr_name)
AttributeError: module 'tensorflow' has no attribute 'io'

虽然Pytorch直接使用的是tensorboard,但还是需要配合tensorflow使用,解决方法:

pip install tensorflow==2.0

问题解决!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1002232.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号