Installing TensorFlow 2.0

Greetings! Some links on this site are affiliate links. That means that, if you choose to make a purchase, The Click Reader may earn a small commission at no extra cost to you. We greatly appreciate your support!

In this chapter, you will learn to install TensorFlow 2.0 on your local machine. TensorFlow 2.0 is tested and supported for Python 3.5–3.8 on the following 64-bit systems:

  • Ubuntu 16.04 or later
  • Windows 7 or later
  • macOS 10.12.6 (Sierra) or later (no GPU support)
  • Raspbian 9.0 or later

TensorFlow official documentation recommends the following two methods for installation:

1. Install using pip in Python

TensorFlow 2.0 can be installed using the pip python package manager by running the following commands on your system.

$ pip install --upgrade pip   # Upgrade pip

$ pip install tensorflow      # Install lastest stable release

$ pip install tensorflow-gpu  # Install GPU version of TensorFlow if you have a CUDA enabled GPU

2. Run a TensorFlow Docker Container

TensorFlow can be used by running the TensorFlow Docker Images.

$ docker pull tensorflow/tensorflow:latest-py3                          # Download latest stable image

$ docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter  # Start Jupyter server 

After installation, TensorFlow can be imported into our code simply as shown below:

import tensorflow as tf

# Check tensorflow version
print(f'Tensorflow Version: tf.__version__}')
Tensorflow Version: 2.2.0

If you got any errors during installation, feel free to mention it in the comment section below. After successfully installing TensorFlow 2.0 on your local machine, head on to the next chapter on the basic data structures used in TensorFlow 2.0.


Installing TensorFlow 2.0Installing TensorFlow 2.0

Do you want to learn Python, Data Science, and Machine Learning while getting certified? Here are some best selling Datacamp courses that we recommend you enroll in:

  1. Introduction to Python (Free Course) - 1,000,000+ students already enrolled!
  2. Introduction to Data Science  in Python- 400,000+ students already enrolled!
  3. Introduction to TensorFlow for Deep Learning with Python - 90,000+ students already enrolled!
  4. Data Science and Machine Learning Bootcamp with R - 70,000+ students already enrolled!

Leave a Comment