要获取有关tensorflow及其选项的更多信息,可以使用以下命令:
>> import tensorflow as tf
>> help(tf)
0
要获取有关tensorflow及其选项的更多信息,可以使用以下命令:
>> import tensorflow as tf
>> help(tf)
0
python中几乎每个普通软件包都将变量.__version__
或VERSION
分配给当前版本。因此,如果要查找某些软件包的版本,可以执行以下操作
import a
a.__version__ # or a.VERSION
对于张量流将是
import tensorflow as tf
tf.VERSION
对于旧版本的tensorflow(低于0.10),请使用tf.__version__
顺便说一句,如果您打算安装tf, 请使用conda而不是pip进行安装
0
对于python 3.6.2:
import tensorflow as tf
print(tf.version.VERSION)
0
这取决于您安装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的版本。
跑:
python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3
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)
0
import tensorflow as tf
print(tf.VERSION)
0
我从源代码安装了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
下图显示了输出:
0
如果您使用的是蟒蛇的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'
0
如果您是通过pip安装的,则只需运行以下命令
$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
0
轻松获得KERAS和TENSORFLOW版本号->在终端中运行以下命令:
[用户名@usrnm:〜] python3
>>import keras; print(keras.__version__)
Using TensorFlow backend.
2.2.4
>>import tensorflow as tf; print(tf.__version__)
1.12.0
0
在最新的TensorFlow版本1.14.0上
tf.VERSION
已弃用,而不是此用途
tf.version.VERSION
错误:
WARNING: Logging before flag parsing goes to stderr.
The name tf.VERSION is deprecated. Please use tf.version.VERSION instead.
0
我需要找到已安装的TensorFlow版本。我正在使用Ubuntu 16.04长期支持。