TranslateProject/sources/tech/20230228.0 ⭐️ How to Install IDLE Python IDE in Ubuntu and Other Linux.md
2023-03-03 08:50:09 +08:00

4.7 KiB
Raw Blame History

How to Install IDLE Python IDE in Ubuntu and Other Linux

Pythons 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 doesnt 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

IDLE install and run in Ubuntu

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.

IDLE icon in the application menu

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.

IDLE editor main window

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.

Running a simple Python statement in IDLE

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.

A python file opened from IDLE

Option to Run the file using menu

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.

Output is shown in a separate output window of IDLE

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.


via: https://www.debugpoint.com/install-idle-ubuntu-linux/

作者:Arindam 选题:lkxed 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出