Intelligence, Inside and Outside.

How To: Install Python 2.7 In Ubuntu

Prerequisites

  • Operating System : Ubuntu 18

 

Steps

Note: By default most Ubuntu 18 system have Python installed.

01. Open a terminal window

02. Check if Python is already installed. Execute the following to determine.

$ python
$ python2.7

A message will be shown if Python is available. In the following case, it is not yet installed.

 

03. Update the package list

$ sudo apt-get update

 

04. Wait for the operation to complete. Then run the command to install Python 2.7.  This also works for lower version of Python like 2.4.

$ sudo apt-get install python2.7

 

05. Verify that Python is installed by accessing the Python shell.

$ python2.7

 

06. Execute a Python application by checking the current time

>>> from datetime import datetime
>>> datetime.now()

 

07. You have now installed Python on your system.

 

Commands Mode Only

# At a CLI interface
$ sudo apt-get update
$ sudo apt-get install python 2.7

# Verify using Python Shell
$ python 2.7
>>> from datetime import datetime
>>> datetime.now()
>>> exit()</span>

 

Benefits of Python

  • Easier syntax compared with other programming languages
  • Less coding, less boiler-plate code, compared with other languages
  • Readability, closer to pseudo-code
  • Object-oriented programming, same concepts as other OOP languages
  • Free.
Read More  How To: Perform Tests for Normality in R

For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!
Share this article
Shareable URL
Prev Post

The Benefits And Risk Of Artificial Intelligence

Next Post

How To: Install Python 3.7 In Ubuntu

Read next

Bard Now Helps You Code

Since we launched Bard, our experiment that lets you collaborate with generative AI, coding has been one of…