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
5. Test
Import test first
import tensorflow as tf
oh~~~ failed, according to the prompt
sudo apt-get install libatlas-base-dev
try import again
import tensorflow as tf
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~~~~