Let's take a look.
Adding software to Raspberry Pi
One way to install software on a Pi is by downloading the source files, compiling them, and installing the software. However, this process can be complicated since the software may require additional "dependencies," such as supporting library software that must be installed before the software can be compiled. Alternatively, you can obtain pre-compiled binary files (similar to .exe files on MS Windows) that others have already compiled. These binary files also have dependencies, such as DLL files on Windows, that need to be installed on the machine.
Package management systems for Raspberry Pi
Here are two commonly used package management systems for Raspberry Pi.
Advanced Package Tool (APT): APT is a command-line tool that comes with Raspberry Pi by default. It is used for installing, updating, and managing packages on Debian-based operating systems, including Raspberry Pi.
pip (package installer for Python): pip is a command-line tool used to install, manage, and remove Python packages from the Python package index (PyPI) repository. pip is used commonly to install Python libraries and packages and their dependencies in Python projects running on a Raspberry Pi.
Using APT to manage packages on Raspberry Pi
Following is a list of APT commands to manage packages on Raspberry Pi.
To install a package/software on your system and all its dependencies, run the following command:
sudo apt-get install <name of software>
To search software by its name in the system, run:
sudo apt-cache search <keyword for search>
To update the repository database on Raspberry Pi, run:
sudo apt-get update
If you want to uninstall/remove a package from your Raspberry Pi, run:
sudo apt-get remove <name of software to remove>
To remove a package and all its configuration files, run:
sudo apt-get --purge remove packagename
To update all the current packages present in your Raspberry Pi with the latest version, run:
sudo apt-get upgrade
Using pip to manage packages on Raspberry Pi
Let’s discuss the commands needed to manage packages on Raspberry Pi using pip.
To install the pip package manager on your system, use the following command:
$ sudo apt install python3-pip
Once pip is installed, you can use the following command to install a package on your Raspberry Pi:
$pip3 install <Package_name>
To remove/uninstall a package, run
$pip uninstall <package-name>
To upgrade a package using pip, run:
$pip install --upgrade --user <package-name>
The two most common package management systems, APT and pip, provide easy and effective ways to install and manage software packages on a Raspberry Pi. Remember, irrespective of which device we use, it's important to follow best practices, like regularly updating packages and creating virtual environments to manage Python packages.
[Image courtesy: Raspberry Pi]