Some Linux distributions don’t come with python. Starting with a guide.

#!/bin/bash
DIR="Python-3.12.3"
if [ ! -d "$DIR" ]; then
  sudo apt update
  sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libbz2-dev
  wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz
  sudo tar -xf Python-3.12.3.tgz
fi:
cd "$DIR"
sudo ./configure --enable-optimizations
sudo make altinstall
echo "alias python=python3.12" >> ~/.bashrc
alias python=python3.12

You can now run python as well as pip.

Note:

  • I didn’t include libsqlite3-dev as I couldn’t find that package but it is optional
  • Running it multiple times will keep adding to the bashrc file