- Operating System : Ubuntu 18
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.
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