如何find哪个版本的TensorFlow安装在我的系统中?
标题说明了一切。 我正在使用Ubuntu 16.04长期支持。
这取决于你如何安装TensorFlow。 我将使用TensorFlow安装说明所使用的相同标题来构造这个答案。
点安装
跑:
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 。 
 pip list | grep tensorflow 用于Python 2或pip3 list | grep tensorflow pip list | grep tensorflow pip3 list | grep tensorflow  Python 3的pip3 list | grep tensorflow也会显示已安装的Tensorflow的版本。 
Virtualenv安装
跑:
 python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3 
 pip list | grep tensorflow  pip list | grep tensorflow也会显示安装的Tensorflow的版本。 
 例如,我已经在Python 3的virtualenv安装了TensorFlow 0.9.0。所以,我得到: 
 $ python -c 'import tensorflow as tf; print(tf.__version__)' 0.9.0 $ pip list | grep tensorflow tensorflow (0.9.0) 
 几乎Python中的每个常规包都将variables.__version__分配给当前版本。 所以,如果你想find一些软件包的版本,你可以做以下的事情 
 import a a.__version__ 
对于tensorflow它将是
 import tensorflow as tf tf.__version__ 
 import tensorflow as tf print tf.VERSION 
我从源码安装了Tensorflow 0.12rc,下面的命令给我版本信息:
 python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2 python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3 
下图显示了输出:
  
 
如果你使用Python的anaconda发行版,
 $ conda list | grep tensorflow tensorflow 1.0.0 py35_0 conda-forge 
使用Jupyter Notebook(IPython Notebook)进行检查
 In [1]: import tensorflow as tf In [2]: tf.__version__ Out[2]: '1.0.0'