How to install Python 3.7 on Raspberry Pi

This short guide explains how to install Python version 3.7.0 on a Raspberry Pi running Raspbian aswell as other Debian based Linux distributions including Ubuntu.

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!)
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure --prefix=/usr/local/opt/python-3.7.0
make -j 4

sudo make altinstall

Make Python 3.7 the default version, make aliases
sudo ln -s /usr/local/opt/python-3.7.0/bin/pydoc3.7 /usr/bin/pydoc3.7
sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7 /usr/bin/python3.7
sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7m /usr/bin/python3.7m
sudo ln -s /usr/local/opt/python-3.7.0/bin/pyvenv-3.7 /usr/bin/pyvenv-3.7
sudo ln -s /usr/local/opt/python-3.7.0/bin/pip3.7 /usr/bin/pip3.7
alias python='/usr/bin/python3.7'
alias python3='/usr/bin/python3.7'
ls /usr/bin/python*
cd ..
sudo rm -r Python-3.7.0
rm Python-3.7.0.tar.xz
. ~/.bashrc

And verify:
python -V

And if you want to revert:
update-alternatives --config python

Raspberry Pi: full upgrade

Running the following commands on Raspbian updates all packages, the distribution and firmware. The system has to reboot twice.


sudo apt-get update
sudo apt-get dist-upgrade


sudo rpi-update

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

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

apt-get install sane

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

How-to Install PHP 7 on a Raspberry Pi

This short guide describes how to install PHP 7 on a Raspberry Pi running Raspbian Linux as operating system.

Edit the apt sources list, /etc/apt/sources.list
sudo nano /etc/apt/sources.list

Add the following lines to the file:

deb jessie-backports main contrib non-free
#deb-src jessie-backports main contrib non-free

Run the following commands in the terminal. You need superuser (root) access.

gpg --keyserver --recv-key CCD91D6111A06851
gpg --armor --export CCD91D6111A06851 | sudo apt-key add -
apt-get update
apt-get install php7.0 php7.0-curl php7.0-gd php7.0-imap php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-xmlrpc

And if you want to install Apache 2 + mod_php:
apt-get install apache2 libapache2-mod-php7.0