如何找到我的系统中安装了哪个版本的TensorFlow

如何找到我的系统中安装了哪个版本的TensorFlow

本文介绍了如何找到我的系统中安装了哪个版本的TensorFlow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到我安装的TensorFlow版本.我正在使用Ubuntu 16.04长期支持.

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

推荐答案

这取决于您安装TensorFlow的方式.我将使用与 TensorFlow的标题相同的标题安装说明来构造此答案.

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.

运行:

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

请注意,在某些Linux发行版中,python被符号链接到/usr/bin/python3,因此在这种情况下,请使用python代替python3.

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或适用于Python 3的pip3 list | grep tensorflow还将显示已安装的Tensorflow的版本.

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

运行:

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

pip list | grep tensorflow还将显示已安装的Tensorflow的版本.

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

例如,我已经在Python 3的virtualenv中安装了TensorFlow 0.9.0.因此,我得到了:

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)

这篇关于如何找到我的系统中安装了哪个版本的TensorFlow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 12:06