How to Download and Install Python Latest Version on Linux?
Python is a widely-used general-purpose, high-level programming language. This article will serve as a complete tutorial on How to download and install Python latest version on Linux Operating Systems.
On every Linux system including following OS,
- Linux Mint
- and my favourite one, Arch Linux.
You will find Python already installed. You can check it using the following commands from the terminal
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
$ python --version
To check latest version of python 2.x.x :
$ python2 --version
To check latest version of python 3.x.x :
$ python3 --version
Clearly it won’t be the latest version of python. There can be multiple methods to install python on a linux base system and it all depends on your linux system.
For almost every Linux system, the following commands would work definitely.
$ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.7
Download and install Python Latest Version on Linux
To install latest version from source code of Python follow below steps
Download Python Latest Version from python.org
- First and foremost step is to open a browser and open
- Underneath the Stable Releases find Download Gzipped source tarball (latest stable release as of now is Python 3.7.4).
You can do all the above steps in a single command
$ wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
Install Python 3.7.4 Latest Version on Linux
For installing Python successfully on Linux, Enter Following command to get the prerequisites and other source files
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
Now we are all ready to unpack the file downloaded from the python official website’
Move to downloads directory using cd downloads in terminal
and then enter following commands
$ tar xvf Python-3.6.5.tgz $ cd Python-3.6.5 $ ./configure --enable-optimizations --with-ensurepip=install $ make -j 8 $ sudo make altinstall
Bingo..!! The latest version of Python language is installed on your Linux system. You can confirm it using below command.
How to set Python 3 as the default version in Linux?
One can easily install python using various techniques mentioned above in their Linux system. But how to set it as default? so that whenever you enter
Pythonanywhere in the terminal it always executes
python3. Here is the simple command from which you can set Python3 as default version.
Open your terminal and enter,
sudo alias python = python3
Now any code executed will automatically get python3 as default version.My Personal Notes arrow_drop_up