How to Install IDLE Python IDE in Ubuntu

When starting out in Python, setting up a coding environment can be challenging. IDLE (Integrated Development Learning Environment) is a Python IDE that simplifies the process for the same. You can start coding immediately after you install it.

IDLE is an easy-to-use IDE with features that make it easier for you to write and run Python code. It comes pre-installed with some operating systems, but on Linux, you need to install it. Learn how to install IDLE on Ubuntu and how to use its interactive shell.

4

Install IDLE on Ubuntu

Out of the severalPython IDEs used in the industry, IDLE is one of the easiest to set up and use. It’s compatible with most operating systems and is suitable for installing any Python version.

IDLEis a cross-platform tool that works the same on Windows, Unix, and macOS operating systems. Configuring it is easy, and it’s compatible with all modern browsers. Before installing IDLE on Ubuntu OS,you should update the system repositories. Run the following code to update the repositories.

ubuntu written on phone next to keys

Next, run the following code to install IDLE version 3:

A successful installation will look like the following:

IDLE installation on Ubuntu

How to Open IDLE

To open IDLE, type the wordidleon the terminal and run it.

The IDLE shell window will pop up on your screen.

open IDLE

Write and Run a Program on IDLE

Now that IDLE is set up, you can start to code. To printHello Worldon the window, write the following code and press enter:

Here, you are writing and running your code in the shell window. This is not feasible for long programs. To create a cleaner workspace, you need to separate the shell window from the editor window.

write and run code on IDLE

Open an Editor Window

To open an editor window, click on theFilemenu on the shell window, then selectNew file. An untitled editor window will open up. You can name the file by clickingFile>Save As.

The code editor provides multiple options to manipulate your code. These include undo, redo, colorize, smart indent, and auto-completion features. Its multi-window allows you to arrange your code, run, and debug quite easily. you may also save your work and resume later on.

The IDLE saves the files with a .pyextension. This way Python can execute it. Let’s try running code using the two windows. Write the following code on the editor window.

To run the code, clickRun>Run moduleon the editor window. You will see it will print the output on the shell window:

Debugging on IDLE

Besides syntax highlighting and automatic indenting features, IDLE has a smart debugging feature. The feature alerts you immediately if you make any mistakes while writing the code.

To test this, try writing code with the wrong syntax on the editor window and run it. The image below shows how IDLE responds to a string without closing quotation marks.

This feature makes IDLE a great debugging tool. It checks for syntax errors, indentation errors, and so on.

Uninstalling IDLE

In case you need to remove or uninstall IDLE, run the following command:

This will uninstall IDLE from your Ubuntu system.

Why Use IDLE?

IDLE is easy to set up and use. It has all the functionalities you need in an efficient IDE. Its interactive shell has an interpreter that highlights code, checks indentation, and debugs errors. The built-in stack viewer traces errors back to their origin.

Also, you’re able to use the IDLE GUI if you’re not completely comfortable with the terminal. IDLE also allows you to search for text within any window. You can also replace words within editor windows and search multiple files. So what are you waiting for? Install the IDE of your choice and start writing code.

Get better at writing and debugging code by installing Visual Studio Code on Ubuntu.

It saves me hours and keeps my sanity intact.

I gripped my chair the entire time—and then kept thinking about it when the screen turned off.

Every squeak is your PC’s way of crying for help.

Freeing up vital memory on Windows only takes a moment, and your computer will feel much faster once you’re done.

Don’t let aging hardware force you into buying expensive upgrades.

Technology Explained

PC & Mobile