install python 3 version

Install Python 3 Version Using Source Code and Yum On Linux

The default version of python we found on the Linux is 2.7. we have to install the latest version. We can install and upgrade the existing version to python 3 using source code on Centos.

python

we will update the environment using yum update -y and if you’ve got the fresh Linux installed.

Check Out: Install Tomcat 10 Server Using Source Code On Linux 8

Install the python package using the below commands. This will install the python 3.6 version.

yum install python3

install python on centos

when you’re upgrading the python, it does not touch your current files that exist on the machine. We can check using python3 –version.

We can also enter in python terminal using /usr/bin/python3.6.

 python 3 install

Check Out: Step To Install Python 3.7 Programming Package On Ubuntu 18.04

Install Python 3.8 On Centos Using Source Code

Before going onwards, there’re a few dependencies that we have to install using the command line.

yum install gcc openssl-devel bzip2-devel libffi-devel

Once all packages installed then download the file using the below command.

curl -O https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz

Extract the package and move it into your folder.

tar -xvf Python-3.8.1.tgz

mv Python-3.8.1 /opt/

cd /opt/Python-3.8.1

ls

upgrade to python 3

Check Out: Learn Top 12 lsof Commands Example For Files In Linux 8

Now I’m going to compile python using the below command.

./configure –enable-optimizations

After compilation of the code, if you require to have the older version, we can keep it without replacing the older one using it.

make altinstall

we will check the current version installed on the machine.

python3.8

upgrade python version

You’re done upgrade to python 3 version

LEAVE A REPLY

Please enter your comment!
Please enter your name here