Set python 3 as default python version in CentOS
NickName:ZhouW Ask DateTime:2019-10-14T10:40:33

Set python 3 as default python version in CentOS

I have installed python 3.6 on my CentOS machine by following the guide at https://linuxize.com/post/how-to-install-python-3-on-centos-7/, which installs python 3 with the following:

sudo yum install rh-python36

The default python version, however, is still python 2. The guide mentions I can run python 3 by first running scl enable rh-python36 bash, and then python 3 will be used. However, this only works for that session - logging out and back in will revert back to python 2. According to How to set Python3.5.2 as default Python version on CentOS?, python 3 can be set as the default with the following:

sudo ln -fs /usr/bin/python3 /usr/bin/python

However, this doesn't work for me as for some reason I don't have any python3 file in /usr/bin/ - I only have python, python2, python2.7, python2.7-config, python2-config and python-config (despite installing python 3 with yum as above).

Copyright Notice:Content Author:「ZhouW」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/58369453/set-python-3-as-default-python-version-in-centos

More about “Set python 3 as default python version in CentOS” related questions

Set python 3 as default python version in CentOS

I have installed python 3.6 on my CentOS machine by following the guide at https://linuxize.com/post/how-to-install-python-3-on-centos-7/, which installs python 3 with the following: sudo yum inst...

Show Detail

How to set Python3.5.2 as default Python version on CentOS?

Is there a way to set the Python 3.5.2 as the default Python version on CentOS 7? currently, I have Python 2.7 installed as default and Python 3.5.2 installed separately. I used the following comm...

Show Detail

how to point django website to python version besides default on centos

I am using Centos and have installed python 2.7 so that I can run django 1.7. I installed python 2.7 according to https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-...

Show Detail

Linux CentOS 7, how to set Python2.7 as default Python version?

I'm using a laptop running Linux CentOS 7. I installed Python2.7, and then I installed Anaconda, which installed Python3.5.2 I want my system to use Python2.7 as default, but if I type python from...

Show Detail

Making 2.7.3 default version of python on CentOS 6

I want to execute python from php and I do have a script that works fine for default python interpreter. I have centos with default python 2.6.6 which is installed at /usr/bin/python and python 2....

Show Detail

python3 not recognizing the correct python 3 version installed (Centos 7)

I just installed python 3.6.8 in Centos via a sudo yum install python3 command and it got installed successfully. However, when I now do python3 --version to check the status, the provided version ...

Show Detail

How to set the python path in Centos Linux

I am new to python and trying to install it on my centos server . By default there was 2.6 version which I deleted and installed the new version 2.7.x ... But I am facing problem . when I type the

Show Detail

How to install python-devel for 2.7 version after upgrade to python 2.7 on CentOS

CentOS 6.7 ships with python 2.6.6, I've upgrade to python 2.7.6 following the tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4 After up...

Show Detail

Unable to set default python version to python3 in ubuntu

I was trying to set default python version to python3 in Ubuntu 16.04. By default it is python2 (2.7). I followed below steps : update-alternatives --remove python /usr/bin/python2 update-alternati...

Show Detail

How to change the RPM default python module configurations to python3 on CentOS 7?

I've installed multiple python versions on CentOS 7 and setup the alternatives like below: # alternatives --list|grep -i python python manual /usr/local/python3/bin/python3.6 But the RPM command...

Show Detail