How to install Python 3.9.4 on Raspberry Pi

This short guide explains how to install Python 3.9.4 on a Raspberry Pi running Raspbian.

First install the dependencies needed to build

sudo apt-get update
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

Compile (takes a while!)
wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tar.xz
tar xf Python-3.9.4.tar.xz
cd Python-3.9.4
./configure --prefix=/usr/bin/python3.9.4
make -j 4

Install
sudo make altinstall

And remove the files

cd ..
rm -r Python-3.9.4
rm Python-3.9.4.tar.xz

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9.2 1
sudo update-alternatives  --set python /usr/bin/python3.9.2

 

 

And verify:
python -V

How to install Python 3.9.2 on Raspberry Pi

This short guide explains how to install Python 3.9.2 on a Raspberry Pi running Raspbian.

First install the dependencies needed to build

sudo apt-get update
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

Compile (takes a while!)
wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tar.xz
tar xf Python-3.9.2.tar.xz
cd Python-3.9.2
./configure --prefix=/usr/bin/python3.9.2
make -j 4

Install
sudo make altinstall

And remove the files

cd ..
rm -r Python-3.9.2
rm Python-3.9.2.tar.xz

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9.2 1
sudo update-alternatives  --set python /usr/bin/python3.9.2

 

 

And verify:
python -V

Installing HPLIP for CUPS on a Raspberry Pi

If you have a HP printer or scanner and you want to be able to use it on your Raspberryi Pi running the Raspbian operating system, you`ll have to install HP Linux Imaging and Printing and CUPS.

In the terminal run the following commands:

sudo su
apt-get update
apt-get install hplip cups
usermod -a -G lpadmin pi

In a browser, on the raspberry pi you can now access the CUPS configuration screen at http://127.0.0.1:631/

If you also would like to use your MFP/scanner also run the following commands in the terminal:

apt-get install sane
sane-find-scanner

The configuration and applications are up to you, the requirements are now installed.