如何查找我的系统中安装了哪个版本的 TensorFlow? [英] How to find which version of TensorFlow is installed in my system?
问题描述
我需要找到我安装了哪个版本的 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 |用于 Python 2 或
还将显示已安装的 Tensorflow 版本.pip3 列表的 grep tensorflow
|Python 3 的 grep 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!