Table of Contents
Install Python on Ubuntu 18.04
Ubuntu 18.04 comes with python 3 installation out of the box as default interpreter. In the minimal installation of Ubuntu this does not come pre-installed so now we are going to install Python on Ubuntu 18.04.
Before you start installing Python on Ubuntu 18.04. You must have nonroot user account on your server with sudo privileges.
Before You Begin
Before we begin please check whether Python is installed or not on your system by typing
If the output shows Python version then you already have Python installed or if it outputs command not found then Python is not installed. However, you can also upgrade or downgrade version of Python.
Install Python 3 on Ubuntu
Update package manager index by typing following command
sudo apt update
The following command will provide minimal installation of Python. now to install Python 3 enter following command
sudo apt install python3-minimal
Confirm the installation and check the version of Python by entering the following command.
The output should be:
Output Python 3.6.6
Install Python 2 On Ubuntu
Before you install Python on ubuntu 18.04, update package manager index by typing following command.
sudo apt update
Following command will provide minimal installation of Python. now to install Python 2 enter following command.
sudo apt install pytho3-minimal
Confirm installation and check version of Python by entering follwing command.
Output should be:
Output: Python 2.7.15rc1
Install Python Modules
Ubutnu repository already have a lot of Python modules. To Search Python modules enter following command
sudo apt search MODULE_NAME
To install searched Python module enter following command
sudo apt install MODULE_NAME
Best way to install and manage python packages
PIP stands for Python Package Index which most popular tool for installation and management of Python packages. You cand check more information about this tool on following link : How to install PIP on Ubuntu 18.04
Here we have learnt how to install Python on Ubuntu 18.04. If You have any queries regarding this then please comment below.