Table of Contents
Introduction
OS Centos 6 is the default Python version 2. How to Install Python 3.6 on Centos 6. Python is a powerful and flexible programming language widely used in various fields such as web development, data science, artificial intelligence, and DevOps. Python 3.6 brings many improvements and new features, enhancing performance and security.
In this article, we will guide you through the process of installing Python 3.6 on CentOS 6, one of the popular Linux operating systems for server environments. This installation will allow you to take full advantage of Python 3.6 in your projects.
Installation packages pre-requisites
sudo yum -y install gcc openssl-devel bzip2-devel wget
How to Install Python 3.6 on Centos 6
cd /tmp/
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
tar xzf Python-3.6.6.tgz
cd Python-3.6.6
./configure --enable-optimizations
sudo make altinstall
Create symbolic link
sudo ln -sfn /usr/local/bin/python3.6 /usr/bin/python3.6
Python verifying new version.
[huupv2@server1 ~]$ python -V
Python 3.6.6
The result is Python 3.6 on Centos 6.
[huupv2@server1 ~]$ cat /etc/redhat-release
CentOS release 6.5 (Final)
[huupv2@server1 ~]$ ll /usr/bin/python*
-rwxr-xr-x 2 root root 4864 Aug 18 2016 /usr/bin/python
lrwxrwxrwx 1 root root 6 Jul 19 2018 /usr/bin/python2 -> python
-rwxr-xr-x 2 root root 4864 Aug 18 2016 /usr/bin/python2.6
lrwxrwxrwx 1 root root 9 Mar 8 13:26 /usr/bin/python3 -> python3.4
-rwxr-xr-x 2 root root 6088 Oct 5 2019 /usr/bin/python3.4
-rwxr-xr-x 2 root root 6088 Oct 5 2019 /usr/bin/python3.4m
lrwxrwxrwx 1 root root 24 Mar 8 14:45 /usr/bin/python3.6 -> /usr/local/bin/python3.6
Configure alias python on .bashrc file
[huupv2@server1 ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
alias python='/usr/bin/python3.6'
Check Python version 3.6 on Centos 6
[huupv2@server1 ~]$ python
Python 3.6.6 (default, Mar 8 2021, 14:41:43)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[huupv2@server1 ~]$
Conclusion
You have to install Python 3.6 on Centos 6. Installing Python 3.6 on CentOS 6 may present some challenges, but with this detailed guide, you can easily accomplish it. Python 3.6 will open up many new opportunities for your projects, from web application development to data processing and automating DevOps workflows.
We wish you success in installing and leveraging the full potential of Python 3.6 on CentOS 6. If you encounter any difficulties, don’t hesitate to contact us or refer to community support resources. I hope will this your helpful. Thank you for reading the DevopsRoles page!