Tensorflow installation is successful but AttributeError: module'tensorflow' has no attribute'__version__' solution

1 Problem description

>>> import tensorflow as tf
>>> tf._version_
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '_version_'

Obviously it has been successfully installed, why doesn't it even have the version number attribute?

2 The solution-maybe a citation error

After inspection, it is found that when referring to the attribute should be

>>> import tensorflow as tf
>>> tf.__version__

It's not obvious alone, now look at the picture:

3 Solution-maybe the tensorflow version is wrong

You should reinstall the version of tensorflow.

pip uninstall tensorflow
pip install --upgrade --ignore-installed tensorflow

Uninstall the existing version of tensorflow first, and then reinstall it.

Pro test is available.

Guess you like

Origin blog.csdn.net/a1456123a/article/details/115269248