How to add programs to the Raspberry Pi 4B?

 On a Raspberry Pi 4B (Raspberry Pi OS), you “add programs” mainly in these ways:



1) Easiest (GUI): Add/Remove Software

If you’re using the desktop:

  • Menu → Preferences → Add/Remove Software

  • Search the app → install

This uses the same package system as the terminal (APT). 


2) Recommended (Terminal): APT packages

APT is the standard/recommended way to install/update/remove software on Raspberry Pi OS. 

sudo apt update sudo apt install <package-name>

Examples:

sudo apt install git sudo apt install python3 sudo apt install vlc

To update everything:

sudo apt update sudo apt full-upgrade

To remove:

sudo apt remove <package-name> sudo apt autoremove

3) Install a downloaded .deb package

If you downloaded a Debian package (must match your architecture: armhf/arm64, not x86_64): 

cd ~/Downloads sudo apt install ./some-package.deb

(Using apt install ./file.deb is nice because it pulls dependencies automatically.)


4) Python programs: use APT or a virtual environment (Bookworm change)

On Raspberry Pi OS Bookworm, using pip system-wide is blocked (“externally managed environment”). You should install Python packages either:

  • via APT (python3-xyz), or

  • inside a venv (virtual environment). 

A) Prefer APT if available

sudo apt install python3-requests

B) Use venv for pip packages

sudo apt install python3-full python3 -m venv ~/venvs/myapp source ~/venvs/myapp/bin/activate pip install <package>

Exit venv:

deactivate

5) Flatpak apps (optional “app store” style)

You can enable Flatpak on Raspberry Pi OS, then install apps from Flathub: 

sudo apt install flatpak flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Then install an app (example):

flatpak install flathub <app-id>

6) From source (advanced)

Typical flow:

sudo apt install build-essential cmake git git clone <repo> cd <repo> mkdir build && cd build cmake .. make -j4 sudo make install

Quick troubleshooting

  • “Unable to locate package” → run sudo apt update, or the package name is different.

  • Downloaded app won’t run → often it’s the wrong CPU architecture (x86 vs ARM). 

  • pip error “externally-managed-environment” → use apt install python3-xyz or a venv.

评论

此博客中的热门博文

Detailed Explanation of STM32 HAL Library Clock System

How To Connect Stm32 To PC?

How do you set up ADC (Analog-to-Digital Converter) in STM32?