TensorFlow CPU installation for Ubuntu 16.04

In this section, we are going to install the CPU version, which doesn't require any drivers prior to installation. So, let's start off by installing some useful packages for data manipulation and visualization:

sudo apt-get update && apt-get install -y python-numpy python-scipy python-nose python-h5py python-skimage python-matplotlib python-pandas python-sklearn python-sympy
sudo apt-get clean && sudo apt-get autoremove
sudo rm -rf /var/lib/apt/lists/*

Next, you can install more useful libraries, such as the virtual environment, Jupyter Notebook, and so on:

sudo apt-get update
sudo apt-get install git python-dev python3-dev python-numpy python3-numpy build-essential  python-pip python3-pip python-virtualenv swig python-wheel libcurl3-dev
sudo apt-get install -y libfreetype6-dev libpng12-dev
pip3 install -U matplotlib ipython[all] jupyter pandas scikit-image

Finally, you can install the latest TensorFlow in CPU mode by issuing the following command:

pip3 install --upgrade tensorflow

You can check whether TensorFlow was installed successfully be running the following TensorFlow statements:

python3
>>> import tensorflow as tf
>>> a = tf.constant(5)
>>> b = tf.constant(6)
>>> sess = tf.Session()
>>> sess.run(a+b)
>> sess.close()

You should get the following output in the terminal:

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

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