How to install the IDLE Python IDE on Ubuntu Desktop 19.10

If Python is your jam, you might be on the lookout for a solid IDE to use. Look no further than IDLE.

How to install the IDLE Python IDE on Ubuntu Desktop 19.10

If you're a Python programmer, chances are good you do much of your work for the Linux environment. Because of that, you have plenty of tools to make your daily grind less grindy and more productive. One such tool is the IDLE Python IDE. 

IDLE stands for Integrated Development Environment and includes features like:

  • Multi-window text editing

  • Syntax highlighting

  • Auto-completion

  • Smart indent

  • Python shell

  • Integrated debugger

The IDLE integrated debugger includes stepping, persistent breakpoints, and call stack visibility. IDLE is also cross platform and is available for Linux, macOS, and Windows.

There are no shortages of features with IDLE. This IDE is both open source and free. I want to show you how easy it is to install on Ubuntu Desktop 19.10.

SEE: Python playbook: Upgrade info, new features, installation and usage tips, and more (free PDF) (TechRepublic)

What you'll need

The only things you'll need to make this work are:

  • A running instance of Ubuntu Desktop 19.10 (though this installation will work on most recent releases, as well as on Ubuntu derivatives)

  • A user account with sudo privileges

How to update/upgrade Ubuntu

Before you install, it's always smart to run an update/upgrade on the system. Note: If the kernel is updated during the process, you'll want to reboot the system so the new kernel takes effect. 

To update/upgrade Ubuntu, log in to the desktop, open a terminal window and issue the following commands:

sudo apt-get update
sudo apt-get upgrade -y

Once the upgrade completes, reboot if necessary. If you reboot, log back in and you're ready to install.

How to install IDLE

The installation of IDLE is incredibly easy. Open a terminal window again and issue the following command:

sudo apt-get install idle -y

That's all there is to the IDLE installation. Once the install completes, IDLE is ready to work.

How to use IDLE

If you click on your desktop menu, you'll find two entries for IDLE. One is labeled IDLE (Using Python 3.75) and the other simply IDLE. If you develop with Python version 3.7.5-1 or newer, open IDLE (using Python 3.75). If you develop with an older version of Python, make sure to use the version labeled simply "IDLE."

When the IDLE window opens (Figure A), you are ready to start coding.

Figure A


The IDLE window, ready for action.

At the IDLE prompt, type the line:

print("Hello, TechRepublic")

Hit Enter on your keyboard and you should see the results (Figure B).

Figure B


Hello, TechRepublic.

Easy, eh? Let's create a new file with code that will check to see if a year is a leap year. To do this, open IDLE and then click File | New. In the resulting window, paste the following code:

year = int(input("Enter a year: "))

if (year % 4) == 0:
  if (year % 100) == 0:
      if (year % 400) == 0:
          print("{0} is a leap year".format(year))
          print("{0} is not a leap year".format(year))
      print("{0} is a leap year".format(year))
  print("{0} is not a leap year".format(year))

Next click File | Save and give the program a name (like Once the file has been saved, click Run | Run Module. A new window will open, asking you to enter a year (Figure C).

Figure C


The run module in action.

With this little Python program, you'll be asked to enter a year and it will then calculate if that year is a leap year. Seeing as how it's the first day of 2020 (and it being a leap year), I thought this apropos.

And that's how you install and use the IDLE Python IDE in Ubuntu Desktop. For more information on getting the most out of this integrated development environment, make sure to read through the official documentation.

Also see

Developing programmer Development Website design and coding technologies working in software company office

Image: iStockphoto/SARINYAPINNGAM