Successfully resolved: AttributeError: module 'tensorflow' has no attribute 'io'

When I was learning tensorboard today, the following error occurred when running the code: AttributeError: module 'tensorflow' has no attribute 'io'

 Modification steps:

1. According to the prompt of the error message, click on the file event_file_writer.py

 2. Enter the event_file_writer.py file and find the import of the package of the file

from tensorboard.compat import tf

 change into:

from tensorboard.compat import tensorflow_stub as tf

 The modified event_file_writer.py file is as follows, save it after modification, and return to your own code file to re-run after saving to succeed

Guess you like

Origin blog.csdn.net/m0_74890428/article/details/130086135