Install TensorFlow with Pip

Table of Contents


There are many different versions of TensorFlow, and many different ways to install it. For this tutorial we will be installing TensorFlow with CPU Support on Ubuntu 16.04, using Pip. This installation method ensures that every user on the server has access to TensorFlow.

Other installation options:

For more information on different installation methods for TensorFlow on Ubuntu, see the official documentation.


  • A 1&1 Cloud Server with Ubuntu 16.04, and either:
    • Python 2.7 and Pip 8.1+, or
    • Python 3.4+ and Pip 3

To check the Python version, use the command:

python -V

To install Pip with Python 2.7:

sudo apt install python-pip python-dev 

To install Pip3 with Python 3.4+:

sudo apt install python3-pip python3-dev

Install TensorFlow

Install Tensorflow with the following command:

  • Python 2.7: pip install tensorflow
  • Python 3.4+: pip3 install tensorflow

TensorFlow will be downloaded and installed.

Validate the Installation

Google has included a TensorFlow test script which you can use to verify that TensorFlow was installed correctly.

Enter the Python client with the command:


Paste in the following program, then hit Enter:

# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()

If TensorFlow is installed correctly, the system will reply with:

Hello, TensorFlow!


Tags: TensorFlow