How to change the python version in the linux?

How to change the python version in the linux?

How to change the python versions temporarily in the linux environment?

If multiple python versions are installed and available on linux environment ( RHEL8 / Fedora | Centos), Lets see here how to change the python version needed temporarily.

$ sudo update-alternatives --config python

Once run above command, displays the available python versions and prompting the required selection.

There are 2 programs which provide 'python'.

  Selection	Command
-----------------------------------------------
*+ 1       	/usr/libexec/no-python
   2       	/usr/bin/python3

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

Once provided the required python selection, the required version is activated for python command.

Lets check the currently active python version,

$ python -V

Output:

Python 3.6.8



Python installation

Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^