Libraries Installation for RPi
From Waveshare Wiki
Revision as of 09:24, 7 June 2017 by Wiki Editorial Team (talk | contribs)
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
Install WiringPi Library
#Open the Raspberry Pi terminal and run the following command cd sudo apt-get install wiringpi #For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required: wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error # Bullseye branch system using the following command: git clone https://github.com/WiringPi/WiringPi cd WiringPi . /build gpio -v # Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error
Install bcm2835
#Open the Raspberry Pi terminal and run the following command wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo . /configure && sudo make && sudo make check && sudo make install # For more information, please refer to the official website: http://www.airspayce.com/mikem/bcm2835/
Install Python Library
#python2 sudo apt-get update sudo apt-get install python-pip sudo pip install RPi.GPIO sudo apt-get install python-smbus #python3 sudo apt-get update sudo apt-get install python3-pip sudo pip install RPi.GPIO sudo apt-get install python3-smbus