четверг, 15 ноября 2018 г.

Change Python from 2.7 to 3.4 ver in Centos7

Sometime you would be swith from default python version (2.7) on Centos 7 to more new for expample 3.4.
In such case you can use next:

Check Python version:

python -V
Python 2.7.5

install more new:

yum install -y python34 

and check python version registered via alternatives :

alternatives --list | grep -i python

If it output empty , you can set new alternatives:

alternatives --install /usr/bin/python python /usr/bin/python3.4 2
alternatives --install /usr/bin/python python /usr/bin/python2.7 1

and check Python version :
python -V
Python 3.4.9

Now you have to set exactly version in files /bin/yum and /usr/libexec/urlgrabber-ext-down: 
replace /usr/bin/python to /usr/bin/python2.7 in the first rows.

That's all.