Getting started
Basic concepts: taking our first steps
Using an IDE
Objects and classes
Loops, ranges, and iterators
Working with files
Exception handling
Python data types
Course project: building a TODO application
And now what?

Installing Python on Linux

There are several ways to install Python on Linux, that is, if you need to install it at all!

Check what’s installed first

Most Linux distributions include Python. Many will include both Python 2 and Python 3.

If you enter python --version on the command line, you’ll see the version number. It’s probably version 2.7:

$ python --version
Python 2.7.16

You don’t want Python 2, but some OS’es still ship with it, unfortunately.

Now try python3 --version. If you get a “command not found,” you need to install Python 3. If your output looks similar to this, you’re in luck:

$ python3 --version
Python 3.8.5

Using a package manager

Depending on the distribution of Linux you are running, you can install python with the default package manager: Yum, APT, etcetera. You’ll need to find out for your specific Linux distribution which package manager is used and how to use it.

If you’re on Ubuntu, Linux Mint, or Debian, you can install python using apt:

$ apt install python3

Homebrew

Another interesting option for Linux is using Homebrew. It’s a top-rated package manager for Macs, but it also supports Linux.

The major advantages of using Homebrew:

  • You’ll get the latest version of Python, instead of the version your OS shipped with.
  • You don’t need root access to your system. All the software installed with Homebrew is installed in your home directory.

I find myself using Homebrew more and more while working under Linux — give it a try, especially if you want to enjoy the latest and greatest Python version!