Python’s default IDE IDLE is not installed by default in Ubuntu and other distros. Learn how to install it in this guide.
IDLE (Integrated Development and Learning Environment) is a Python IDE, written in Python language itself and usually gets installed in Windows as part of Python installation. It is ideal for beginners and straightforward to use. For those who are learning Python, such as students, it can be a good IDE to start with.
Basic features such as syntax highlighting, smart ident, and auto-completion are some of the features of this IDE. You can always learn more about the IDLE features in the official documentation.
IDLE in Ubuntu and other Linux
All Linux distributions, including Ubuntu, come with Python pre-installed. Even if you manually upgrade or install Python versions, the IDLE IDE doesn’t come with that. You have to install it manually.
For Debian, Ubuntu, Linux Mint and related distribution open a terminal and run the following command to install IDLE.
sudo apt update
sudo apt install idle3
Hit yes when the command asks you whether you want to install IDLE or not. After the command is complete, IDLE will be installed in your Ubuntu system.
For Fedora, RHEL, CentOS, use the following command to install it.
sudo dnf update
sudo dnf install idle3
Arch Linux users can install it using the following command.
sudo pacman -S python tk
Launching IDLE and writing a sample program to test
After the installation in Ubuntu, Debian, Linux Mint, and Fedora – you can find the IDLE icon in the application menu. See below.
If you are using Arch Linux, you need to run below from the command line to launch IDLE.
idle
Once you launch IDLE, you should see the main window, as shown in the image below.
By default, it shows you a shell where you can directly execute Python codes in each line. It works like any shell interpreter. And when you hit enter, you get the output, and the three “>” symbols go to the next line for the next command.
IDLE also allows you to open any .py file from its file menu. It will open the file in a separate window where you can make changes and run it directly. You can run using F5 or from the option Run > Run Module.
The output is shown in a separate output window. From the output window, you can start debugging, step into a line or file, view stack trace and other options.
Closing Notes
Now you learned how to install the IDLE IDE in Ubuntu and other distributions and how to run a statement or a Python program. IDLE can be a good starting point for beginners to grasp the basics before heading over to more complex IDEs.
I hope this guide helps you on your Python journey.