AttributeError: module 'tensorflow' has no attribute 'app' AttributeError: module 'tensorflow' has no attribute 'app' python-3.x python-3.x

AttributeError: module 'tensorflow' has no attribute 'app'


try using import tensorflow.compat.v1 as tf


Which Tensorflow version, are you using? If it is TF2.0 then you need to replace tf.app.flags with tf.compat.v1.flags defined here since it is no longer supported.


use absl if you don't want to downgrade tf.

from absl import appif __name__ == '__main__':        app.run(main)