How to find which version of TensorFlow is installed on my system?

The title says it all. I use long-term support for Ubuntu 16.04.

+187
python command-line ubuntu version tensorflow
Jul 24. '16 at 6:06
source share
13 answers

It depends on how you installed TensorFlow. I am going to use the same headers as the TensorFlow installation instructions to structure this answer.




Gun installation

Run:

python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2 python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3 

Note that python symbolically attached to /usr/bin/python3 on some Linux distributions, so use python instead of python3 in these cases.

pip list | grep tensorflow pip list | grep tensorflow for Python 2 or pip3 list | grep tensorflow pip3 list | grep tensorflow for Python 3 will also show a version of Tensorflow.




Install Virtualenv

Run:

 python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3 

pip list | grep tensorflow pip list | grep tensorflow will also show a version of Tensorflow.

For example, I installed TensorFlow 0.9.0 in virtualenv for Python 3. So, I get:

 $ python -c 'import tensorflow as tf; print(tf.__version__)' 0.9.0 $ pip list | grep tensorflow tensorflow (0.9.0) 
+316
Jul 24 '16 at 6:25
source share

Almost every normal package in python assigns a .__version__ or VERSION variable to the current version. Therefore, if you want to find a version of a package, you can do the following

 import a a.__version__ # or a.VERSION 

For tensor flow it will be

 import tensorflow as tf tf.VERSION 

For older tenorflow versions (below 0.10) use tf.__version__

By the way, if you plan to install tf, install it using conda, not pip

+56
Apr 29 '17 at 4:36 on
source share
 import tensorflow as tf print(tf.VERSION) 
+25
Jun 09 '17 at 22:26
source share

If you installed via pip, just run the following

 $ pip show tensorflow Name: tensorflow Version: 1.5.0 Summary: TensorFlow helps the tensors flow 
+20
Mar 30 '18 at 13:49
source share

If you are using anaconda distribution for Python,

 $ conda list | grep tensorflow tensorflow 1.0.0 py35_0 conda-forge 

To test this using a Jupyter Notebook (IPython Notebook)

 In [1]: import tensorflow as tf In [2]: tf.__version__ Out[2]: '1.0.0' 
+9
Feb 17 '17 at 20:05
source share

For Python 3.6.2:

 import tensorflow as tf print(tf.version.VERSION) 
+7
Jan 21 '18 at 14:57
source share

I installed Tensorflow 0.12rc from the source code, and the following command will give me version information:

 python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2 python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3 

The following figure shows the result:

enter image description here

+5
Dec 09 '16 at 17:50
source share

To get more information about tenorflow and its parameters, you can use the following command:

 >> import tensorflow as tf >> help(tf) 
+3
Jan 29 '18 at 11:01
source share

It is easy to get the version number of KERAS and TENSORFLOW -> Run this command in the terminal:

[username @usrnm: ~] python3

>>import keras; print(keras.__version__)

Using TensorFlow backend.

2.2.4

>>import tensorflow as tf; print(tf.__version__)

1.12.0

+2
Mar 15 '19 at 7:08
source share
 python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2 python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3 

Here -c represents the program passed as a string (completes the list of options)

+1
Jan 6 '18 at 12:28
source share

In the latest version of TensorFlow 1.14.0

tf.VERSION

deprecated use instead

tf.version.VERSION

MISTAKE:

 WARNING: Logging before flag parsing goes to stderr. The name tf.VERSION is deprecated. Please use tf.version.VERSION instead. 
+1
09 Sep '19 at 16:35
source share

The tenorflow version can be checked on the terminal or console, as well as in any IDE editor (for example, Spyder or Jupyter notepad, etc.)

Simple command to check version:

 (py36) C:\WINDOWS\system32>python Python 3.6.8 |Anaconda custom (64-bit) >>> import tensorflow as tf >>> tf.__version__ '1.13.1' 
0
Aug 08 '19 at 6:19 06:19
source share

For Python 3.6.3:

 import tensorflow as tf print(tf.VERSION) 
-four
Dec 07 '17 at 3:53 on
source share



All Articles