Raspberry Pi and Python
Introduction
With Phidgets, you can easily extend the functionality of your Raspberry Pi. Follow the steps below to get your first Python program running on your Pi!
Install the Phidget Libraries
If you are using a Raspberry Pi model 2 or above, you can simply enter the following command into the terminal to install the Phidget libraries:
curl -fsSL https://www.phidgets.com/downloads/setup_linux | bash - &&\
apt-get install -y libphidget22
curl -fsSL https://www.phidgets.com/downloads/setup_linux | sudo -E bash - &&\
sudo apt-get install -y libphidget22
Your terminal will look something like this:
If you are using an older version of the Raspberry Pi, visit our Linux page and view the Source Install instructions.
Install the Phidget Python Module
Now that the libraries (drivers) are installed, the Phidget Python Modules can be installed. You can do this from a specific development environment, like Thonny (bundled with Raspberry Pi OS), or you can install it system-wide through the terminal.
Open the terminal and enter the following command:
pip3 install Phidget22
Start by opening Thonny.
Thonny defaults to a simple mode on the Raspberry Pi. Click on Switch to regular mode if you have not previously.
Next, select Tools > Manage Packages.
Finally, search for Phidget22 and press Install.
Run Your Python Program
Now that the Phidget libraries and Python module are installed, you can begin developing against your Phidgets on the Raspberry Pi with Python!