How to find which version of TensorFlow is install

2019-01-16 03:06发布

The title says it all. I'm using Ubuntu 16.04 Long Term Support.

10条回答
Viruses.
2楼-- · 2019-01-16 03:38

If you're using anaconda distribution of Python,

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

To check it using Jupyter Notebook (IPython Notebook)

In [1]: import tensorflow as tf
In [2]: tf.__version__
Out[2]: '1.0.0'
查看更多
欢心
3楼-- · 2019-01-16 03:40
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 program passed in as string (terminates option list)

查看更多
家丑人穷心不美
4楼-- · 2019-01-16 03:41

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)
查看更多
对你真心纯属浪费
5楼-- · 2019-01-16 03:43

If you have installed via pip, just run the following

$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
查看更多
Ridiculous、
6楼-- · 2019-01-16 03:46

To get more information about tensorflow and its options you can use below command:

>> import tensorflow as tf
>> help(tf)
查看更多
神经病院院长
7楼-- · 2019-01-16 03:48
import tensorflow as tf

print tf.VERSION
查看更多
登录 后发表回答