
Python is popular programming language. By default, in Ubuntu 18.04 python 3 comes pre-installed as default interpreter. If the installation is minimal of Ubuntu then it does not come pre-installed so now we are going to install Python on Ubuntu 18.04.
Python is a versatile programming language and you can use it to write small scripts, build games, develop websites, create machine learning algorithms, analyze data and more.
Prerequisites
Before you start installing Python on Ubuntu 18.04 you must logged in as nonroot user account with sudo privileges.
Install Python 3 on Ubuntu
At first, update the package manager index by issue below command:
sudo apt update
Now run the below command to install python 3 with minimal installation.
sudo apt install python3-minimal
You can verify the installation by executing below command:
python3 -V
It will show output as below:
Output
Python 3.6.6
Installing Python 3.7 on Ubuntu
Python 3.7 is the latest release of the Python language. It includes many new features. You can get more details about Python 3.7 from official website.
It is very easy and straightforward process to install Python 3.7 on Ubuntu. Same as above first need to update package manager index and install prerequisites by running below command:
sudo apt update sudo apt install software-properties-common
Next, you need to add the deadsnakes PPA to your sources list using below command:
sudo add-apt-repository ppa:deadsnakes/ppa
You will be prompted with message so here hit Enter key to continue:
Output
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Now, repository is enabled so issue below command to install python:
sudo apt install python3.7
Now you can check installed version of python by typing:
python3.7 --version
It should show output as below:
Python 3.7.6
Install Python Modules
By default, Ubuntu repository have many Python modules. You can search specific modules using below command:
sudo apt search MODULE_NAME
Here, you should replace MODULE_NAME with module name which you want to search.
After that, you can install searched module with with following command:
sudo apt install MODULE_NAME
Same as above replace MODULE_NAME with module name.
Install & Manage Python Packages
PIP is a package management system used for installation and management of software packages in Python. PIP stands for Python Package Index (PyPI). It is very popular for python package management. You can get more details on following link : How to Install Pip on Ubuntu
Conclusion
You have installed Python 3 and 3.7 on your Ubuntu 18.04 machine and you can start developing your Python 3 project.
If you have any questions or suggestion don’t hesitate to comment below.
Leave a Reply