Construction of Tensorflow in the Raspberry Pi environment

Construction of Tensorflow in the Raspberry Pi environment

1.python3.4

The tensorflow framework on the Raspberry Pi requires python3.4 version, so install python3.4 first

sudo apt install python3.4

2. virtual environment virtualenv

Install virtualenv for package conflicts and package management convenience

sudo apt-get install virtualenv

3. Create a virtual environment

First use virtualenv to create a basic environment for tensorflow

virtualenv -p python3.4 TensorFlow

After the creation is complete, ls, a folder named TensorFlow has appeared in the current folder

Open the TensorFlow folder and activate the current environment

cd TensorFlow
source bin/activate

After activation, you can start installing the tensorflow package

4. Install tensorflow

Get the tensorflow package for Raspberry Pi on github , which is version 1.1. After downloading, transfer it to the Raspberry Pi and open the folder where the .whl file is located.

pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl

write picture description here

5. Test

Import test first

import tensorflow as tf

oh~~~ failed, according to the prompt
write picture description here

sudo apt-get install libatlas-base-dev

write picture description here
try import again

import tensorflow as tf

write picture description here
OK! It worked!

Download a code in github's tensorflow project to test it

python3 classify_image.py

Wonderful! The recognition result of the panda appears~~~~
write picture description here

refer to:

  1. Help documentation for virtualenv
  2. Official installation guide for tensorflow for Raspberry Pi
  3. Problem solving reference in step 5

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324957766&siteId=291194637