Skip to content

Instantly share code, notes, and snippets.

@spk921
Created December 29, 2016 03:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spk921/65dce2bc86c8470f388187c6169517a7 to your computer and use it in GitHub Desktop.
Save spk921/65dce2bc86c8470f388187c6169517a7 to your computer and use it in GitHub Desktop.
TensorFlow version check
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
@divya1md
Copy link

divya1md commented Jul 25, 2017

python3 -c 'import tensorflow as tf; print(tf.version)'
by using this command got some errors.
instead use below command;
python -c "import tensorflow as tf; print(tf.version)"

@wednesy
Copy link

wednesy commented Oct 18, 2017

I got the following error. Any idea?

$ python3 -c 'import tensorflow as tf; print(tf.__version__)' 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '__version__'

@Khoa-NT
Copy link

Khoa-NT commented Oct 18, 2017

Try this
python -c "import tensorflow as tf; print(tf.version)" # for Python 2
python3 -c "import tensorflow as tf; print(tf.version)" # for Python 3

@IU2FQT
Copy link

IU2FQT commented Nov 3, 2017

import tensorflow as tf
tf. version

@IU2FQT
Copy link

IU2FQT commented Nov 3, 2017

import tensorflow as tf
tf.__version__

or also

import tensorflow as tf
help(tf)

@mphz
Copy link

mphz commented Jan 8, 2018

above is correct one

@ssa21
Copy link

ssa21 commented Mar 26, 2018

Try
python -c "import tensorflow as tf; print(tf.VERSION)"

or

import tensorflow as tf
tf.VERSION

@TethysSun
Copy link

TethysSun commented Apr 6, 2018

I tried
python3 -c "import tensorflow as tf; print(tf.VERSION)"
python3 -c "import tensorflow as tf; print(tf.version)"
python3 -c "import tensorflow as tf; print(tf.__version__)"

Errors showed up:
AttributeError: module 'tensorflow' has no attribute 'VERSION'
or
AttributeError: module 'tensorflow' has no attribute '__version__'

and I also tried this
pip list | grep tensorflow

which didn't work too.
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

Any idea? BTW, I built it from source.

@poethan
Copy link

poethan commented May 21, 2020

Hi all, I got similar problem here.
from tensorflow.contrib.slim import parallel_reader, tfexample_decoder
ModuleNotFoundError: No module named 'tensorflow.contrib'

if Tensorflow.contrib does not exist anymore in the Colab, can I change the code " from tensorflow.contrib.slim import parallel_reader, tfexample_decoder" into any other wording to achieve the function please?
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment