Template: Libraries Installation for RPi

From Waveshare Wiki
Jump to: navigation, search

Libraries Installation for RPi

PS: If you are using the system of the Bullseye branch, you need to change "apt-get" to "apt". The system of the Bullseye branch only supports Python3.

First of all you make sure to use which language C or python Open the terminal of Raspberry Pi and install libraries as guides below

C

C language is installed as follows First of all you make sure to use which language C or python You only need to install one kind of library, install the corresponding library, and then in the Makefile file

# USELIB = USE_BCM2835_LIB
# USELIB = USE_WIRINGPI_LIB
USELIB = USE_DEV_LIB

Just select the corresponding library, the default is to read and write files without installing any libraries

Install WiringPi Library

If you use WiringPi, you need to update WiringPi to version 2.52. This library may not be updated. Other libraries are recommended

cd
sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v

Install bcm2835

cd
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz 
cd bcm2835-1.60/
sudo ./configure
sudo make && sudo make check && sudo make install

For more information and the newest libraries please refer to website:http://www.airspayce.com/mikem/bcm2835/

Install Python Library

sudo pip3 install pillow
sudo pip3 install numpy
sudo apt-get install libopenjp2-7
sudo apt install libtiff
sudo apt install libtiff5
sudo apt-get install libatlas-base-dev
For python2
cd
sudo apt-get update
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install smbus
For python3
cd
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install RPi.GPIO
sudo pip3 install smbus