Reputation: 21
I am running python3.7.4 Shell program under tensorflow. When I input sess = tf.Session(),the command line prompt me that module 'tensorflow' has no attribute 'Session' this is the message : " Traceback (most recent call last): File "", line 1, in sess = tf.Session() AttributeError: module 'tensorflow' has no attribute 'Session'
> "
plz help
Upvotes: 1
Views: 12801
Reputation: 631
You must be using tensorflow 2, which does not use session anymore but rather greedy execution. Please refer to their doc for more information.
Alternatively, there is a backward compatibility module: tensorflow.compat.v1 you can use like so:
>>> import tensorflow.compat.v1 as tf
>>> tf.Session()
Upvotes: 2