I need to find which version of TensorFlow I have installed. I’m using Ubuntu 16.04 Long Term Support.
Advertisement
Answer
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:
JavaScript
x
3
1
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
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:
JavaScript
1
2
1
python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3
2
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:
JavaScript
1
6
1
$ python -c 'import tensorflow as tf; print(tf.__version__)'
2
0.9.0
3
4
$ pip list | grep tensorflow
5
tensorflow (0.9.0)
6