96

Question is the same as the title says.

I prefer not to open Python and I use either MacOS or Ubuntu.

aerin
  • 20,607
  • 28
  • 102
  • 140

6 Answers6

161

Python library authors put the version number in <module>.__version__. You can print it by running this on the command line:

python -c 'import keras; print(keras.__version__)'

If it's Windows terminal, enclose snippet with double-quotes like below

python -c "import keras; print(keras.__version__)"
Om Sao
  • 7,064
  • 2
  • 47
  • 61
aerin
  • 20,607
  • 28
  • 102
  • 140
42

You can write:

python
import keras
keras.__version__
Noosh
  • 762
  • 7
  • 7
19

The simplest way is using pip command:

pip list | grep Keras
docjag
  • 431
  • 4
  • 7
6

Simple command to check keras version:

(py36) C:\WINDOWS\system32>python
Python 3.6.8 |Anaconda custom (64-bit) 

>>> import keras
Using TensorFlow backend.
>>> keras.__version__
'2.2.4'
rsnayak
  • 340
  • 2
  • 6
5

pip show tensorflow

C:\>pip show tensorflow
Name: tensorflow
Version: 2.4.1
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
Requires: google-pasta, wheel, absl-py, flatbuffers, numpy, astunparse, opt- 
einsum, six, termcolor, typing-extensions, wrapt, grpcio, tensorboard, 
protobuf, tensorflow-estimator, gast, h5py, keras-preprocessing
Required-by:

Same way can try for

pip show keras

If it is installed then it will provide the details.

Ashish Tripathi
  • 339
  • 4
  • 4
1

For terminal, run: (Change with python3 for version of Python3)

python -c 'import keras; print(keras.__version__)'

Or if you want to check inside code, include:

import keras
print(keras.__version__)
Joyanta J. Mondal
  • 888
  • 1
  • 8
  • 20