3

I have a Rhel version of a Linux and would like to upgrade from Python 3.6 to 3.7.2

What is the best and proven way to do it?

Tried with yum but seems that does not have latest versions of python..

Joe
  • 11,983
  • 31
  • 109
  • 183
  • Possible duplicate of [How to upgrade Python version to 3.7?](https://stackoverflow.com/q/51279791/608639), [How to Install Python 3.7.2 on CentOS/RHEL 7/6](https://tecadmin.net/install-python-3-7-on-centos/), [How to install Python 3 on Red Hat Enterprise Linux](https://developers.redhat.com/blog/2018/08/13/install-python3-rhel/), [How to upgrade to python 3.7 on Fedora or Centos](https://web3us.com/drupal6/how-guides/how-upgrade-python-371-fedora-or-centos), etc. – jww Mar 22 '19 at 11:47
  • ^^ that's a little different since Ubuntu is a different OS, if you want a specific RHEL solution, have you enabled `subscription-manager`? – gold_cy Mar 22 '19 at 11:47
  • Did not use `subscription-manager`. What is the process for it? Does CentoOS has as well? – Joe Mar 22 '19 at 11:49
  • CentOS does not use subscription-manager. Configuration of RPM channels varies quite a bit between CentOS and Red Hat Enterprise Linux, so which is it? – Florian Weimer Mar 22 '19 at 13:16
  • Currently I have a need or Rhel server.. but there are few other servers that are CentOS that also need the same python upgrade.. – Joe Mar 22 '19 at 19:20

2 Answers2

3

Sharing what worked for me. Worked for me on Enterprise RHEL 7.

#-> python --version
Python 2.7.5

#-> yum install rh-python38

#-> scl enable rh-python38 bash

#-> python --version
Python 3.8.0

But you will have enter into the scl shell everytime as the default shell would still be Python 2.7. To make this permanent, I had to

Add this to my ~/.bash_profile

source /opt/rh/rh-python38/enable
Achilleus
  • 1,824
  • 3
  • 20
  • 40
2

Below command worked for me.

sudo dnf install python3.8 -y

I wanted to use python3.8 and removed old python3.6 and installed python3.8 using above command

command to remove python3.6

sudo dnf remove python3.6 -y
Tapan Hegde
  • 1,222
  • 1
  • 8
  • 25