Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I need to find which version of TensorFlow I have installed. I'm using Ubuntu 16.04 Long Term Support.

like image 718
Hans K Avatar asked Jul 24 '16 06:07

Hans K


People also ask

How do I find the version of TensorFlow in Windows?

Issue pip show tensorflow command If you have installed tensorflow using pip then you can easily get the version by running pip show tensorflow within your command prompt.

Which version of Python is TensorFlow?

Requirements. The TensorFlow Python API supports Python 2.7 and Python 3.3+. The GPU version works best with Cuda Toolkit 7.5 and cuDNN v5. Other versions are supported (Cuda toolkit >= 7.0 and cuDNN >= v3) only when installing from sources.


2 Answers

This depends on how you installed TensorFlow. I am going to use the same headings used by TensorFlow's installation instructions to structure this answer.


Pip 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 is symlinked to /usr/bin/python3 in some Linux distributions, so use python instead of python3 in these cases.

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


Virtualenv installation

Run:

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

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

For example, I have installed TensorFlow 0.9.0 in a 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) 
like image 139
edwinksl Avatar answered Oct 12 '22 00:10

edwinksl


Almost every normal package in python assigns the variable .__version__ to the current version. So if you want to find the version of some package you can do the following

import a a.__version__ 

For tensorflow it will be

import tensorflow as tf tf.version.VERSION 

For old versions of tensorflow (below 0.10), use tf.__version__

like image 42
Salvador Dali Avatar answered Oct 11 '22 23:10

Salvador Dali