latest tensorflow version code example

Example 1: update tensorflow pip

######## for Python 2.7
pip install --upgrade pip
pip install --upgrade tensorflow

######## for Python 3.n
pip3 install --upgrade pip
pip3 install --upgrade tensorflow

Example 2: pip install tensorflow not working

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Example 3: install tensorflow

pip install tensorflow

Example 4: install tensorflow

sudo pip3 install tensorflow

Example 5: tensorflow_version

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

Tags:

Misc Example