Installing Python3 on the GNU/Linux PC

Is Python installed on my PC? If so, what version is it?

A lot of modern software - like mining software for the Duinocoin - requires Python on the PC. Most of the time Python is preinstalled in the current version 3 - it is better to check that.

In rare cases, the Python interpreter gives error messages when starting the mining software on the PC. To exclude these errors, you have to check which Python version is installed and possibly update to a current version 3.7 or newer.

Pre.. raw:: html

<img src="https://vg05.met.vgwort.de/na/4694429c434a43dfaf1673f98396a8de" width="1" height="1" alt="">

requisite: Computer with Python 3

A PC or notebook with Windows, GNU/Linux or a BSD, a Raspberry Pi with Raspberry Pi OS or an Apple Mac with Mac OS X are the prerequisites for normal DUCO mining. The operating system basically doesn't matter as long as you run the Python interpreter version 3.x on it. Preferably, you should also be able to install the Arduino IDE in order to be able to program (flash) the microcontrollers - but you could also do this without any problems using only avrdude. Or you could simply use the Arduino IDE for programming on another system.

Is Python installed, and if so: which version?

/img/tipps_tricks/Install_Python3.png

This checks which commands and versions of Python are installed.

To check if Python 3 is present, do the following:

  • GNU/Linux: Open terminal via Ctrl-Alt-T (if necessary, use Ctrl-Alt-F2, back with Ctrl-Alt-F7).
  • Windows**: Open Powershell via Win+R and "powershell".
  • Mac OS**: Finder > Applications > Utilities > Terminal

At the prompt, enter the following:

python --version

or

python -V

The two minus signs are important (except with Mac OS X). If "python" is not found, you can try "python3 -- version", then the version is hardcoded. The result should look something like this:

mipl@z600:~$ python --version
    Python 3.9.2

This machine (an HP Z600 workstation with Devuan GNU/Linux 3.0 "Chimaera" freed from systemd) is obviously running Python 3.9.2.

"python" or better "python3"?

In some GNU/Linux distributions, "python" (without appended 2 or 3) is not present as a command. You could set a symbolic link, but this is not recommended because a lot of older software assumes that "python" denotes a Python 2.x interpreter and then there are strange problems in the system.

There are two different Python versions in practice: Python 2.x.y and Python 3.x.y. The 2 or 3 stands for the "major version". The "x" is the "minor version" and should be as high as possible, currently for example at least "3.7". The "y" is the "micro version", indicates patch levels and minor updates and is insignificant for users and thus the Duinocoin software.

Attention. Python software written for Python 2.x (mostly 2.7) usually does not run with Python 3.x - and vice versa!

Python 2.x is outdated and no longer maintained, any Python software should be updated to Python 3. Tip: There is a small tool from Python to automatically convert the code from Python 2 to Python 3: 2to3.py.

On GNU/Linux systems Python 3 is mostly pre-installed, on Windows you have to install it manually. How to install Python 3 on Windows, GNU/Linux and Mac OS X is on the official Python website.

Installing Python3 on GNU/Linux PC

Python3 is pre-installed on most GNU/Linux distributions. If this is not the case, it can be easily set up via the respective package management, here using the example of the Devuan GNU/Linux I use (but this applies to all Debian-based Linuxes):

sudo apt-get update
sudo apt-get upgrade
    sudo apt-get install python3

The first two commands update the database of the package management (update) and then the operating system (upgrade) - although the latter is not absolutely necessary for Duinocoin mining.

Other GNU/Linux distributions use different package managers. The most common are:

  • Debian / Ubuntu: apt-get install python3
  • Rocky / Fedora / RHEL: dnf install python3
  • OpenSUSE: zypper install python3
  • Arch Linux: pacman -S python3
  • Gentoo: emerge --ask python3
  • Void Linux: xbps-install -S python3

For BSDs (Python3 is usually already installed there, too) it goes like this:

  • FreeBSD: pkg install python3
  • OpenBSD: pkg_add -r python3
  • NetBSD: pkgin install python3
  • Dragonfly BSD: pkg install python3

Install Python3 on Windows 10 PC

For Windows, you need to download an installer that the Python project provides on its project page. The installer is started and installs Python3 on the PC.