How to install Python IDLE in Linux

If you have just started learning Python, you probably are using IDLE. IDLE is a cross-platform application used by many beginners. If IDLE is not already installed on your Mac or Linux, this article will help you to install it on a Linux box.

Installing Python IDLE in Linux

Most new Linux comes with Python installed which is bundled with IDLE. If for some reason Python is not there in your Linux distro, you can install it using a default package manager.

Run the following command Debian or Ubuntu terminal to install IDLE

sudo apt-get install idle3 # this command installs IDLE for Python3, if you are using Python2+, you can just change idle3 to idle in the command.

If you want to install IDLE in CentOS, Red Hat, or Fedora, run the following command

sudo yum install python3-tools

Once the installation is done, you can open IDLE from the start menu, or type idle in the terminal. It should look something like the below:

IDLE for Linux

IDLE has to autocomplete support, you can enable it using ALT + Space Linux and CTRL + Space Mac.

Write Hello Word in Python IDLE

To create a new Python file, select the file from the menu and click the new file. You can write your program and save the file by selecting save from the file menu.

Run the program by pressing F5 or selecting “Run Module” from Run Menu.

Run python code in IDLE in Linux