成功解决:AttributeError: module ‘tensorflow‘ has no attribute ‘io‘

今天在学习tensorboard时,运行代码出现了下面报错:AttributeError: module 'tensorflow' has no attribute 'io'

 修改步骤:

1.根据报错信息的提示,点击event_file_writer.py这个文件

 2.进入到event_file_writer.py这个文件,找到该文件的包的导入

from tensorboard.compat import tf

 修改为:

from tensorboard.compat import tensorflow_stub as tf

 修改后的event_file_writer.py文件为下面这样,修改后进行保存,保存后回到自己的代码文件中重新运行就可以成功了

猜你喜欢

转载自blog.csdn.net/m0_74890428/article/details/130086135
今日推荐