728x90


I will explain how to change the Python version.

By default the Python version is 2.7

Option Description:
'--config python' 
 - Python version change option
'--install [symbolic link path] python [real path] number'
 - Register the version.

Do the following:
1) '$ sudo update-alternatives --config python'
 - If no alternative is set, nothing is displayed.

2) '$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1'
    '$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2'
 - Register Python 2.7 and 3.6 versions.

3) '$ sudo update-alternatives --config python'
 - Enter '$ sudo update-alternatives --config python' again to open the version selection menu.

4) '2'
 - Since we are using 3.6, enter 2.

5) '$ python --version'
 - Check that the desired Python version is set.

728x90
728x90

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.



2.7 is not supported, so you have to upgrade to 3.x.


'ls /bin | grep python' to check if there is a 3.X version.

[--@------- ~]$ ls /bin | grep python
pmpython
python
python2
python2.7

If there is no 3.X version, type sudo yum install python3 to install the 3.X version.

[--@------- ~]$ sudo yum install python3

Installed:
  python3.x86_64 0:3.6.8-18.el7

Dependency Installed:
  python3-libs.x86_64 0:3.6.8-18.el7        python3-pip.noarch 0:9.0.3-8.el7         python3-setuptools.noarch 0:39.2.0-10.el7

Complete!


Check the version.

[--@------- ~]$ python --version
Python 2.7.5

[--@------- ~]$ python3 --version
Python 3.6.8

[--@------- ~]$ ls /bin | grep python
pmpython
python
python2
python2.7
python3
python3.6
python3.6m

 

Now you need to change to the Python 3.6 version you have installed.
https://clear-sky-sun.tistory.com/142

 

[Linux] change python version

I will explain how to change the Python version. By default the Python version is 2.7 Option Description: '--config python'  - Python version change option '--install [symbolic link..

clear-sky-sun.tistory.com





728x90

+ Recent posts