Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 1.64 KB

File metadata and controls

79 lines (53 loc) · 1.64 KB

Notes and warnings

  • Do not remove your system python3 (often 3.11 or 3.13); keep it for the OS packages.
  • Using a virtual environment is the safest way to avoid conflicts between system and project packages.
  • If you use update‑alternatives, make sure your spotd user (or pi/root) uses the same Python version in its shell.

Check your current Python version

Open a terminal and run:

python3 --version
python --version

If you see Python 3.13 or higher, continue with the steps below.

Method A – Install Python 3.12 using apt (Debian/Ubuntu/Raspberry Pi OS)

This is the easiest method if you are on Raspberry Pi OS or Ubuntu/Debian.

  1. Update package list:
sudo apt update
  1. Install Python 3.12 and pip:
sudo apt install python3.12 python3.12-venv python3.12-dev
  1. Verify the installation:
python3.12 --version

You should see something like:

Python 3.12.x
  1. Install pip for Python 3.12 (if not already present):
python3.12 -m ensurepip --upgrade
  1. Test with pip:
python3.12 -m pip --version

Method B – Use update-alternatives (optional, set python to 3.12)

If you want python and python3 to point to Python 3.12 in your shell, you can use update‑alternatives.

  1. Add Python 3.12 to update‑alternatives:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
  1. Choose the default Python 3:
sudo update-alternatives --config python3

Select the entry for python3.12.

  1. Verify:
python3 --version

It should now show Python 3.12.x.