How to Install TensorFlow on Raspberry Pi

Recently, I planned to implement offline face recognition on embedded devices, so I decided to install TensorFlow on Raspberry Pi 3.

Below I will introduce how to install TensorFlow on Raspberry Pi 3. It is actually very simple and can be done quickly. However, due to the limitations of the Raspberry Pi server, our internet speed is usually only a few kb. Therefore, the first step is to change the software source to a domestic source, which can achieve over 900kb per second after modification.

Change Software Source

【Backup】

Before modifying, back up the source list, and then modify sources.list

cd /etc/apt

cp sources.list sources.list_back

【Modify】

sudo nano sources.list

For example, using the Neusoft University software source mirror, the modified content is as follows:

deb http://mirrors.neusoft.edu.cn/raspbian/raspbian wheezy main contrib non-free rpi

deb http://mirrors.neusoft.edu.cn/raspbian/raspbian jessie main contrib non-free rpi

【Finally】

# Update Software Source

sudo apt-get update

# Update Software

sudo apt-get upgrade

Install TensorFlow

First, install the dependencies for TensorFlow:

sudo apt-get update

Next, download the wheel file from this repository and install it:

# For Python 2.7

wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp27-none-linux_armv7l.whl

sudo pip install tensorflow-1.1 .0-cp27-none-linux_armv7l.whl

Finally, we need to reinstall the mock library to prevent errors when importing TensorFlow:

# For Python 2.7

sudo pip uninstall mock

sudo pip install mock

How to Install TensorFlow on Raspberry Pi

If it displays like this, it means you have successfully installed TensorFlow.

Leave a Comment

×