Installation of TensorFlow

By performing a simple and clean TensorFlow installation, the installation becomes very easy, and a simple pip statement will be fine. So if your are installing TensorFlow just to learn its capabilities, you can run the following code:

$ pip install tensorflow

To install TensorFlow in a conda environment, run the following:

conda install –n tensorflow spyder

TensorFlow, however, overrides existing installations of Python. So if Python is being used for other processes, the previous installation may break the existing versions. In such a case, it is recommended that you either check the respective dependencies or get hold of a virtual environment where you can do the TensorFlow installation.

In the following section, we will set up a virtual environment where we will install TensorFlow. We start with installing virtualenv in the machine, as shown:

$ pip install virtualenv

The virtualenv functions enable us to have a virtual environment in your system. In the virtual system, we create a folder called tf where we install TensorFlow, as shown here:

 $ cd ~
$ mkdir tf
$
virtualenv ~/tf/tensorflow

We activate the TensorFlow environment with the following command:

$ source ~/tf/tensorflow/bin/activate

We then install TensorFlow in the environment:

(tensorflow)$ pip install tensorflow

TensorFlow gets installed with the required dependencies. To exit from the TensorFlow environment, run the following command:

(tensorflow)$ deactivate

This will get you back to the regular prompt:

$ 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset