Han*_*kar 199 python ubuntu command-line version tensorflow
标题说明了一切.我正在使用Ubuntu 16.04长期支持.
edw*_*ksl 334
这取决于您安装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
Run Code Online (Sandbox Code Playgroud)
请注意,在某些Linux发行版中python是符号链接的/usr/bin/python3,因此请使用python而不是python3在这些情况下.
pip list | grep tensorflow对于Python 2或pip3 list | grep tensorflowPython 3,还将显示已安装的Tensorflow版本.
跑:
python -c 'import tensorflow as tf; print(tf.__version__)' # for both Python 2 and Python 3
Run Code Online (Sandbox Code Playgroud)
pip list | grep tensorflow 还将显示安装的Tensorflow版本.
例如,我在virtualenvPython 3中安装了TensorFlow 0.9.0 .所以,我得到:
$ python -c 'import tensorflow as tf; print(tf.__version__)'
0.9.0
$ pip list | grep tensorflow
tensorflow (0.9.0)
Run Code Online (Sandbox Code Playgroud)
Sal*_*ali 59
几乎python中的每个普通包都会分配变量.__version__或VERSION当前版本.因此,如果您想查找某个软件包的版本,可以执行以下操作
import a
a.__version__ # or a.VERSION
Run Code Online (Sandbox Code Playgroud)
对于张量流,它将是
import tensorflow as tf
tf.VERSION
Run Code Online (Sandbox Code Playgroud)
对于旧版本的tensorflow(低于0.10),请使用 tf.__version__
顺便说一句,如果你打算安装tf,请用conda安装,而不是pip
小智 29
import tensorflow as tf
print(tf.VERSION)
Run Code Online (Sandbox Code Playgroud)
Tri*_*ath 22
如果您已通过pip安装,请运行以下命令
$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Run Code Online (Sandbox Code Playgroud)
kma*_*o23 10
如果您使用的是anaconda分发的Python,
$ conda list | grep tensorflow
tensorflow 1.0.0 py35_0 conda-forge
Run Code Online (Sandbox Code Playgroud)
使用Jupyter Notebook(IPython Notebook)检查它
In [1]: import tensorflow as tf
In [2]: tf.__version__
Out[2]: '1.0.0'
Run Code Online (Sandbox Code Playgroud)
对于python 3.6.2:
import tensorflow as tf
print(tf.version.VERSION)
Run Code Online (Sandbox Code Playgroud)
我从源代码安装了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
Run Code Online (Sandbox Code Playgroud)
下图显示了输出:
在最新的 TensorFlow 版本1.14.0
版本
已弃用,而不是这种用途
tf.version.VERSION
错误:
WARNING: Logging before flag parsing goes to stderr.
The name tf.VERSION is deprecated. Please use tf.version.VERSION instead.
Run Code Online (Sandbox Code Playgroud)
小智 6
要了解 python 库的任何版本,那么如果您的库是使用 pip 安装的,则使用以下命令。
pip show tensorflow
Run Code Online (Sandbox Code Playgroud)
上述命令的输出将如下所示:-
Name: tensorflow
Version: 2.3.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: astunparse, wheel, keras-preprocessing, gast, tensorflow-estimator, opt-einsum, tensorboard, protobuf, absl-py, six, wrapt, termcolor, numpy, grpcio, scipy, google-pasta, h5py
Required-by: fancyimpute
Run Code Online (Sandbox Code Playgroud)
要获取有关 tensorflow 及其选项的更多信息,您可以使用以下命令:
>> import tensorflow as tf
>> help(tf)
Run Code Online (Sandbox Code Playgroud)
轻松获取 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
| 归档时间: |
|
| 查看次数: |
523729 次 |
| 最近记录: |