How to setup Python3 Programming on Fedora/Red Hat/CentOS

Python3 usually comes shipped in Fedora distributions and Red Hat Linux. For CentOS you might need to install it and in some cases it also come per-intsalled.

However, the GUI might be missing and a lot of users are stuck on how to work from the Terminal in Linux so we brought this great article to aid GUI installtion on Fedora/RedHat/CentOS Linux distributions. It is pretty much the same for Ubuntu and Debian based Linux distributions too.

They are available both in paperback, and free in Kindle ebook format. Included in the first manuscript is instructions for installing Python on Windows, on Mac OS X, and on Ubuntu and Linux Mint. The instructions for Ubuntu and Linux Mint involve compiling from source; these are not needed. This post shows how to install Python3 directly from the Fedora 30 repositories. It includes instructions for installing the packages and python modules needed in the section Know how to start IDLE. No doubt other modules will be required.

The Python3 interpreter is probably already installed on your Fedora installation. To check, open a terminal window and enter:

python3 -V

This should produce output similar to:

Python 3.6.5

If, instead, you get an error message, then you need to install python:

sudo dnf install python3

Once this command completes, check again that Python3 has been installed.

In addition to Python3, you will need a text editor or IDE, and the Python package installer (pip3). Any text editor, or any IDE that supports Python, may be used. Python provides IDLE3, which is available as a separate package in the Fedora repositories. You can start with this if you wish. I have switched to VS Code, but IDLE3 is sufficient to begin with. The Python website states that the Python package installer is now available as part of Python, but that is only true if you download installers from the Python website. The Linux distros I have tried all provide pip3 as a separate package. To install IDLE3 and pip3, execute the following at the terminal’s command prompt:

sudo dnf update
sudo dnf install python3-pip python3-idle redhat-rpm-config 
        python3-devel python3-tk

IDLE3 can be started either from the command line (idle3) or from the Gnome dash (IDLE3). pip3 is a command line only utility. Here is how to install a couple of python packages using pip3:

pip3 install --user vpython
pip3 install --user matplotlib

These Python modules are required by the example scripts that are included with the books.

Note: The examples are out of date, and require corrections to run. Since that is not the topic of this post, I will leave the changes for you to figure out.

That’s it. You will need additional Python modules as you learn to program in Python, but they can be loaded using pip3.

Leave a Reply

Your email address will not be published. Required fields are marked *