How to install TensorFlow on Raspberry Pi 2

随声附和 提交于 2019-12-06 07:39:10

问题


I'm trying to install TensorFlow on a Raspberry Pi 2 with Raspian Lite OS installed on and a 8 Gb SD card. I'm using Python version 2.7.9 and I'm trying to install TensorFlow for it. I previously searched and tried to solve the problem by me but couldn't do it. Already followed these guides:

  1. TensorFlow Official Guide
  2. IotMakerBlog guide
  3. Sam J Abrahams guide on GitHub

I have also read a lot of solutions proposed in some other Stack Overflow questions, but the problem is always the same:

 tensorflow-1.1.0-cp27-none-linux_armv7l.whl is not a supported wheel on this platform.

This happens everytime I try to download the .whl and use pip to install it. Moreover, if I try to use pip directly, the error I get is the following:

# pip install tensorflow
Collecting tensorflow
  Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

I also tried with pip2 as suggested in some guides and I also tried to install the Python 3 version. The result is the same as here.

Could anyone help me? Many thanks.


回答1:


At the end I found that the problem was the processor. Indeed, with Raspbian it is considered to be ARMv6 but it is ARMv7. So, changing OS to Ubuntu MATE did the trick. Now I have installed TensorFlow on my Pi.




回答2:


You can follow this:

First, install the dependencies for TensorFlow:

sudo apt-get update

# For Python 2.7
sudo apt-get install python-pip python-dev

# For Python 3.3+
sudo apt-get install python3-pip python3-dev

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

# For Python 3.4
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
sudo pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl

Finally, we need to reinstall the mock library to keep it from throwing an error when we import TensorFlow:

# For Python 2.7
sudo pip uninstall mock
sudo pip install mock

# For Python 3.3+
sudo pip3 uninstall mock
sudo pip3 install mock

See more details from tensorflow-on-raspberry-pi.




回答3:


@all, I noticed that you were trying to have tensorflow running on Raspberry Pi 2. If you are willing to try tensorflow lite on Raspberry Pi 3 as well, my "pull-request" may be useful. My contribution is at https://github.com/tensorflow/tensorflow/pull/24194.

Following my steps, 2 apps to get your own development started, label_image and camera, can run on Raspberry Pi 3.

Best,

--Jim




回答4:


Miniconda (Anaconda) can install python 3.4 with a version of pip that can upgrade to the latest pip which can install tensorflow-1.11.0-cp34 as well as keras wheels for the Arm processor:

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
bash Miniconda3-latest-Linux-armv7l.sh
pip install --upgrade pip
pip install tensorflow keras


来源:https://stackoverflow.com/questions/43734513/how-to-install-tensorflow-on-raspberry-pi-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!