【问题标题】:How do I find out the version of TensorFlow on my computer?如何在我的计算机上找到 TensorFlow 的版本?
【发布时间】:2016-12-25 18:08:42
【问题描述】:

在我的计算机上查找 TensorFlow 版本的命令是什么?我前段时间在我的电脑上安装了 TensorFlow,并想确保我拥有最新版本。

【问题讨论】:

标签: tensorflow


【解决方案1】:
import tensorflow as tf
tf.__version__

【讨论】:

  • 您可能会遇到这样的错误:“ImportError: cannot import name pywrap_tensorflow”。您可能只是从 Tensorflow 目录运行 Python。只需切换到不同的目录,它应该可以工作。
  • 能否查看是否安装了GPU/CPU版本?
【解决方案2】:
pip list | grep tensorflow

您可以通过将“tensorflow”替换为库名称来查找任何已安装库的版本。

【讨论】:

    【解决方案3】:
    $ pip show tensorflow
    Name: tensorflow
    Version: 1.5.0
    Summary: TensorFlow helps the tensors flow
    

    【讨论】:

      【解决方案4】:

      使用以下代码在 jupyter-Notebook/Pycharm 中检查 tensorflow 版本。

      import tensorflow as tf
      
      print(tf.version.VERSION)
      

      【讨论】:

      • 当我在 Ubuntu 18.04 上使用 tensorflow 版本 2.4 在终端中打开 python 3.8 时,这也有效。
      【解决方案5】:
      $ source activate tensorflow
      $ pip show tensorflow
      Name: tensorflow
      Version: 1.9.0
      Summary: TensorFlow is an open source machine learning framework for everyone.
      Home-page: https://www.tensorflow.org/
      Author: Google Inc.
      Author-email: opensource@google.com
      License: Apache 2.0
      

      【讨论】:

      • 欢迎在 Stack Overflow 上发帖。感谢您的回答。但请尽量避免仅制作代码(或仅命令)答案。 How to Answer
      【解决方案6】:

      你可以试试这个:

      pip freeze|grep tensorflow
      

      【讨论】:

        【解决方案7】:
        $ import tensorflow as tf
        $ tf.test.is_built_with_cuda()
        True
        $ tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None)
        False
        

        【讨论】:

          猜你喜欢
          • 2020-04-24
          • 1970-01-01
          • 2017-07-15
          • 2011-05-29
          • 1970-01-01
          • 2020-12-27
          • 1970-01-01
          • 2019-05-27
          • 2017-11-10
          相关资源
          最近更新 更多