'ImportError: cannot import name 'tf2' from 'tensorflow.python' (unknown location)

from tensorflow.python import tf2 ImportError: cannot import name 'tf2' from 'tensorflow.python' (unknown location)



Solution 1:[1]

You do not need to specify tf2, if you want to use TensorFlow 2 you can simply install

pip install tensorflow

which installs the latest version of tensorflow. Then to use it in python code, you can simply write

import tensorflow

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pierrotb1