How to Install TensorFlow

In this guide, we will discuss How to install TensorFlow, it is important to have “Python” installed in your system. Python version 3.4+ is considered the best to start with TensorFlow installation.

Consider the following steps to install TensorFlow in Windows operating system.

Step 1 − Verify the python version being installed.

python version installed

Step 2 − A user can pick up any mechanism to install TensorFlow in the system. We recommend “pip” and “Anaconda”. Pip is a command used for executing and installing modules in Python.

Before we install TensorFlow, we need to install Anaconda framework in our system.

install anaconda

After successful installation, check in command prompt through “conda” command. The execution of command is displayed below −

conda command executive

Step 3 − Execute the following command to initialize the installation of TensorFlow −

conda create --name tensorflow python = 3.5
installation of tensorflow

It downloads the necessary packages needed for TensorFlow setup.

Step 4 − After successful environmental setup, it is important to activate TensorFlow module.

activate tensorflow
environmental setup

Step 5 − Use pip to install “Tensorflow” in the system. The command used for installation is mentioned as below −

pip install tensorflow

And,

pip install tensorflow-gpu
pip to install
pip to install tensorflow

After successful installation, it is important to know the sample program execution of TensorFlow.

Following example helps us understand the basic program creation “Hello World” in TensorFlow.

hello world example

The code for first program implementation is mentioned below −

>> activate tensorflow
>> python (activating python shell)
>> import tensorflow as tf
>> hello = tf.constant(‘Hello, Tensorflow!’)
>> sess = tf.Session()
>> print(sess.run(hello))

Next Topic : Click Here

This Post Has One Comment

Leave a Reply