Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Upgrade Python 2.7 to 3.6 and installing pip on CentOS 7

Rumi, April 2, 2021

Installing Development Tools

Development tools are required for building Python modules. To install the necessary tools and libraries type:

sudo yum groupinstall 'Development Tools'

Enable Software Collections (SCL)

Software Collections , also known as SCL is a community project that allows you to build, install, and use multiple versions of software on the same system, without affecting system default packages. By enabling SCL you will gain access to the newer versions of programming languages and services which are not available in the core repositories.

CentOS 7 ships with Python 2.7.5 which is a critical part of the CentOS base system. SCL allows you to install newer versions of python 3.x alongside the default python v2.7.5 so that system tools such as yum will continue to work properly.

To enable SCL, you need to install the CentOS SCL release file. It is part of the CentOS extras repository and can be installed by running the following command:

sudo yum install centos-release-scl

Installing Python 3.6 on CentOS 7

Now we will install Python 3.6, which is the latest version available at the time of writing. To do so type the following command on your CentOS 7 terminal:

sudo yum install rh-python36

Using Python 3

Once the package rh-python36 is installed, check the Python version by typing:

python --version
Python 2.7.5

You will notice that Python 2.7 is the default Python version in your current shell.

To access Python 3.6 you need to launch a new shell instance using the Software Collection scl tool:

scl enable rh-python36 bash

What the command above does is calling the script /opt/rh/rh-python36/enable, which changes the shell environment variables.

If you check the Python version again, you’ll notice that Python 3.6 is the default version in your current shell now.

python --version
Python 3.6.3

It is important to point out that Python 3.6 is set as the default Python version only in this shell session. If you exit the session or open a new session from another terminal Python 2.7 will be the default Python version.

Install pip

Now let’s install python-pip and any required packages:

yum -y install python-pip

Src:
https://linuxize.com/post/how-to-install-python-3-on-centos-7/
https://www.liquidweb.com/kb/how-to-install-pip-on-centos-7/

Administrations Configurations (Linux) CentOS 7CnetOSPIPPythonPython 3.6

Post navigation

Previous post
Next post

Comments (4)

  1. Alex says:
    March 17, 2022 at 4:26 pm

    Very good, it work.
    could you make the same with last version of python 3.10.x

    Reply
    1. Rumi says:
      March 18, 2022 at 9:03 pm

      Perhaps I’ll do it someday!

      Reply
  2. Bob J says:
    March 22, 2022 at 8:42 pm

    Does this leave the older version on the server? If so, Shouldn’t we also be removing it?

    Reply
    1. Rumi says:
      April 1, 2022 at 7:58 pm

      As you’re upgrading it’s pointless to keep the old version too, unless there is a necessity of having some backward compatibility of any other app using the older version

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes