How to find which version of TensorFlow is installed in my system?

前端 未结 16 1913
轮回少年
轮回少年 2020-11-30 17:00

I need to find which version of TensorFlow I have installed. I\'m using Ubuntu 16.04 Long Term Support.

相关标签:
16条回答
  • 2020-11-30 17:54

    To get more information about tensorflow and its options you can use below command:

    >> import tensorflow as tf
    >> help(tf)
    
    0 讨论(0)
  • 2020-11-30 17:55

    Easily get KERAS and TENSORFLOW version number --> Run this command in terminal:

    [username@usrnm:~] python3

    >>import keras; print(keras.__version__)

    Using TensorFlow backend.

    2.2.4

    >>import tensorflow as tf; print(tf.__version__)

    1.12.0

    0 讨论(0)
  • 2020-11-30 17:56

    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.


    Pip installation

    Run:

    python -c 'import tensorflow as tf; print(tf.__version__)'  # for Python 2
    python3 -c 'import tensorflow as tf; print(tf.__version__)'  # for Python 3
    

    Note that python is symlinked to /usr/bin/python3 in some Linux distributions, so use python instead of python3 in these cases.

    pip list | grep tensorflow for Python 2 or pip3 list | grep tensorflow for Python 3 will also show the version of Tensorflow installed.


    Virtualenv installation

    Run:

    python -c 'import tensorflow as tf; print(tf.__version__)'  # for both Python 2 and Python 3
    

    pip list | grep tensorflow will also show the version of Tensorflow installed.

    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)
    
    0 讨论(0)
  • 2020-11-30 17:56

    For knowing any version of the python library then if your library is installed using the pip then use the following command.

    pip show tensorflow
    

    The Output of the above command will be shown below:-

    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
    
    0 讨论(0)
提交回复
热议问题