How to Install Python3 on DietPi using DietPi-Software

This tutorial aims to show how to install programs on DietPi using the DietPi-Launcher, using Python installation as an example.

DietPi presents itself as a lightweight Linux distribution that allows it to be installed with as few programs as possible.


The “How to install DietPi minimal image on RPi Zero 2 W and configure SSH access via Wi-Fi” tutorial shows how the installation process should be carried out, as well as a possible way to establish an SSH connection.


This tutorial presents a possible way to use the tools available by DietPi, in order to perform system updates and how to install new programs. Therefore, the process is exemplified using the installation of Python 3 on a Raspberry Pi Zero 2 W with a minimal version of DietPi.

Parts Required

  • DietPi installed (on a SBC);
  • MobaXterm (or Putty, or some software that provides SSH access).

Accessing DietPi-Launcher and checking for system updates

Before installing any program on a Linux distribution, it is advisable to check if it is necessary to check if the system is up to date.

1. After establishing an SSH connection type “dietpi-launcher” to access the DietPi tools.

2. After that press down the arrow key until you select “DietPi-Update” and press enter.

Example of the process of searching for updates.

3. If you want to perform the available update, select the option as shown in the following figure and press enter.

4. Confirm your choice (select “Ok” and press enter).

Example of running the update.
Example of the result of a successful update.

Installing Python with DietPi-Software

1. On DietPi-Launcher select the option “DietPi-Software: Install optimized ready-to-run software“.

Note: If you have performed the updates to DietPi, a notification will appear to restart the device in question (in this case it was a Raspberry Pi Zero 2 W). Select “Ok”, restore SSH connection, and relaunch DietPi-Launcher until select DiectPi-Software.

2. After DietPi-Software is started, it is possible to select the program(s) that you want to install in two ways: you can perform a search by the name of the program or you can access all programs that are optimized for DietPi and select what you want.

2.1. Install Python via search method.

2.1.1. Select the “Search Software” option.

2.1.2. Write the full name or part of the name of the program you want to install and press enter.

2.1.3. After that select the version of the program that suits your needs. In this case, the development-oriented version of Python was selected.

2.2. Install Python via the navigation method.

2.2.1. Select the “Browse Software” option.

2.2.2. Just press the down arrow key until you find the version of the program you want to install.

3. After selecting all the programs that you pretend to install, go to “Install: Go >> Start installation for selected software” and press enter.

4. Confirm your choices and press enter.

Example of what will appear on the command line during installation.

Check if ‘python3’ is installed

There are two simple ways to test if Python is installed: run the command to see which version of Python is installed or try to start Python to run commands.

1. As you can see, in the following image, after running the command “python3 –version” it will return the version that was installed.

2. Can start python by running the following command: “python3“. After that, the version installed will appear and you will be able to execute lines of code, as shown in the following image “print(“Hello World!”)“.

To close Python just type “exit()“.

References

[1] https://dietpi.com/docs/

[2] https://dietpi.com/docs/getting_started/

[3] https://dietpi.com/docs/software/

[4] https://dietpi.com/docs/dietpi_tools/

Leave a Reply

Your email address will not be published.