Blog

Python 3.7 And 2.7 Installation Steps On Windows 10

Changing python default versions on fedora 27?

Python websockets installation is failed on fedora linux

Network Basics

Document Clustering

Clustering Techniques

SQL Injection and Prevention Techniques

Google Form Intro and App Scripts

Download in Youtube using Youtube-dl commands

Java Network Launch Protocol File Launch Issue

javaws command is not working

Forcing Website with HTTPS instead of HTTP

Cricket Scores API's

Design Patterns

IIS Installation and Configuration on Windows 10

Unable to start debugging on the web server (IIS Error Code 405)

Google Chrome Installation on Fedora 26, CentOS / RHEL 7.4

Install Fedora 26 On Virtual Machine Using VirtualBox in Windows 10

Using screen command in fedora 25

Java JDK 1.8 Installation Steps On Windows 10

Enable Permanent SSH Access on Linux

C Program Undefined Reference Error

Curl error and couldn't resolve hostname fedora mirrors

Installing Android Studio in Windows 10

Resetting Root password on Fedora 26

Installing visual studio code editor steps for fedora 27 / centos 7 / RHEL 7

Java JNI Error UnsupportedClassVersionError in Windows 10

Install virt-customize in RHEL 8

Updating qcow2 image in RHEL 8

Remove the files from dir in another dir

Install virtualenv in RHEL 7

Install Scapy in RHEL 7

SQL ACID properties

How to change default python versions on fedora 27 / CentOS / RHEL ?



How to change default python versions on fedora 27 / CentOS / RHEL ?

how to we know the available python version packages on fedora linux system?

$ ls /usr/bin/python*

Lists the available python version packages as below.

/usr/bin/python2	/usr/bin/python2.7-futurize	/usr/bin/python3	/usr/bin/python3.6m
/usr/bin/python2.7  /usr/bin/python2.7-pasteurize  /usr/bin/python3.6  /usr/bin/python3-chardetect

Based on above, there are two python versions python 2.7 and python3.6 available in fedora system.

How to check the python default version in fedora

$ python -V
Output:
Python 2.7.15

By default python3 command is there to run the python3 code on fedroa system.

$ python3 -V
Python 3.6.6

How to change python command to use python3 version for current user on fedora system ?

$ alias python='/usr/bin/python3.6'

Now default version for python command is using python3.6 version for current user.

$ python -V
Python 3.6.6

but if you check the python default version in other user, this change will not be updated.

Let's check with root user

$ sudo -i
# python -V
Python 2.7.15

How to change python defualt versions globally on fedora / centos / RHEL linux ?

alternatives command is available in fedora to change the python version globally to all the users on fedara linux system.

alternatives syntax

   	alternatives --install    
                	[--initscript ]
                	[--family ]
                	[--slave   ]*
   	alternatives --remove  
   	alternatives --auto 
   	alternatives --config 
   	alternatives --display 
   	alternatives --set  
   	alternatives --list
   	alternatives --remove-all 

Let us first check whether any alternative python version is registered in the fedora system

$  alternatives --list | grep -i python

If no alternatives registered, nothing will be displayed.

To register the python alternatives, need to use alternatives with --intall option.

Creates the alternative python version for 3.6 with high priority 10

$ sudo  alternatives --install /usr/bin/python python /usr/bin/python3.6 10

Creates the alternative python version for 2.7 with priority 1.

$ sudo alternatives --install /usr/bin/python python /usr/bin/python2.7 1

Once created alternative python versions, we can change the python version using alternatives command with --config option.

$ sudo alternatives --config python

There are 2 programs which provide 'python'.

  Selection	Command
-----------------------------------------------
*+ 1       	/usr/bin/python3.6
   2       	/usr/bin/python2.7

Enter to keep the current selection[+], or type selection number: 2

Here we have selected the python version 2.7, and check the default python version in fedora linux

$ python -V
Python 2.7.15

Check the python version as root user as well.

$ sudo -i
# python -V
Python 2.7.15

 Blog

Python 3.7 And 2.7 Installation Steps On Windows 10

Changing python default versions on fedora 27?

Python websockets installation is failed on fedora linux

Network Basics

Document Clustering

Clustering Techniques

SQL Injection and Prevention Techniques

Google Form Intro and App Scripts

Download in Youtube using Youtube-dl commands

Java Network Launch Protocol File Launch Issue

javaws command is not working

Forcing Website with HTTPS instead of HTTP

Cricket Scores API's

Design Patterns

IIS Installation and Configuration on Windows 10

Unable to start debugging on the web server (IIS Error Code 405)

Google Chrome Installation on Fedora 26, CentOS / RHEL 7.4

Install Fedora 26 On Virtual Machine Using VirtualBox in Windows 10

Using screen command in fedora 25

Java JDK 1.8 Installation Steps On Windows 10

Enable Permanent SSH Access on Linux

C Program Undefined Reference Error

Curl error and couldn't resolve hostname fedora mirrors

Installing Android Studio in Windows 10

Resetting Root password on Fedora 26

Installing visual studio code editor steps for fedora 27 / centos 7 / RHEL 7

Java JNI Error UnsupportedClassVersionError in Windows 10

Install virt-customize in RHEL 8

Updating qcow2 image in RHEL 8

Remove the files from dir in another dir

Install virtualenv in RHEL 7

Install Scapy in RHEL 7

SQL ACID properties

Privacy Policy  |  Copyright@2017 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^