Install Python3 and IDLE on Ubuntu 18.04

28/12/2020
Python 3.6 should be installed on Ubuntu 18.04 LTS by default. Python 3.7 (still in beta) is also available in the official package repository of Ubuntu 18.04 LTS at the time of this writing. But it’s not installed by default.

In this article, I will show you how to install Python 3.6 and Python 3.7 in case you don’t have it installed. Let’s get started.

Installing Python 3

First update the package repository cache with the following command:

$ sudo apt-get update

The package repository cache should be updated.

Installing Python 3.6:

Now to install Python 3.6, run the following command:

$ sudo apt-get install python3.6

As you can see from the screenshot below, Python 3.6 is already installed as I said.

Installing Python 3.7:

To install Python 3.7 (still in beta at the time of this writing), run the following command:

$ sudo apt-get install python3.7

Press y and then press <Enter>.

Python 3.7 should be installed.

You can run the following command to verify whether Python 3.7 is working:

$ python3.7 –version

As you can see, it’s working.

Installing Python 3 IDLE for Developing Python Program

Python 3 IDLE is a graphical program for writing python 3 programs and test them. It is beginner friendly. You can always start writing Python 3 code with Python 3 IDLE. It is lightweight and has nice syntax highlighting ability.

Python 3 IDLE is available in the official package repository of Ubuntu 18.04 LTS.

For Python 3.6:

To install Python 3 IDLE for Python 3.6, run the following command:

$ sudo apt-get install idle-python3.6

Press y and then press <Enter> to continue.

It should be installed.

For Python 3.7:

To install Python 3 IDLE for Python 3.7, run the following command:

$ sudo apt-get install idle-python3.7

Using IDLE to Develop a Python 3 Program

Now that you have Python 3 IDLE installed, you can go to the Application Menu and search for Python 3 IDLE.

You should see the following icon as marked in the screenshot below, click on it.

You should see the following window. This is a Python 3.6 shell where you can execute python codes, one line at a time. It is good for testing very simple codes or logics before putting it to your Python 3 source code file.

Now to go to the graphical editor, click on File and you should see the following menu. From here you can click on Open… to open an existing Python 3 source code file in the graphical editor.

NOTE: You can also press <Ctrl> + o to open an existing Python 3 source file in the graphical editor.

Or you can click on New File… to create a new file and open it in the graphical editor.

NOTE:  You can also press <Ctrl> + n to create a new file and open it in the graphical editor.

I created a new file, and when you do, it should look something like this. This is the graphical code editor.

Once you write some code in it, save it somewhere on your filesystem. To save the file, click on File and then click on Save as shown in the screenshot below.

NOTE: You can also save the file by pressing <Ctrl> + s.

Now let’s write our very first Python 3 program and save it as hello.py somewhere on your filesystem.

To run the program, click on Run and then click on Run Module. You can also press F5 to run the program.

As you can see, the correct output is displayed on the console.

Customizing Python 3 IDLE

You can go to Options and then Configure IDLE to go to the configuration window of Python 3 IDLE.

Settings window should open as you can see in the screenshot below. From the Fonts/Tabs tab, you can change your IDLE font, font size, the default indentation width.

From the Highlights tab, you can change the Color Scheme or Theme of IDLE. By default, IDLE Classic is set. You can also choose IDLE Dark and IDLE New as you can see in the marked section of the screenshot below.

Once you’re done, click on OK. The changes should be applied.

IDLE Dark theme:

That’s how you install Python 3 and start learning Python 3 on Ubuntu 18.04 LTS. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to Install Anaconda Python on Ubuntu 18.04 LTS

Anaconda Python is a Python distribution just like Ubuntu is a Linux distribution. Anaconda Python comes pre-installed...
29/12/2020

Regular Expressions in Python

In this article, we will take a brief look at regular expressions in python. We will work on built in functions with examples...
28/12/2020

Python with JSON Files

With the growth and evolution of challenges in computer science, Python continues to rise as the primarily sought-after...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024