Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
change python version
05-31-2018, 11:42 AM
Post: #1
change python version
the default version of python on CentOS 7 is python 2.7.5
when we need to install some software depend on other version of python, we have to change our python version

download version you want, here we offer python2.7.9 as an example:
you can download other version in the same form as followed

unzip file
tar -zxvf Python-2.7.9.tgz

install gcc if you need
yum install gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib

we need to do install in /Python-2.7.9
cd Python-2.7.9

add sudo if permission denied
don't use 'make install' or it will overwrite the default python in system
(sudo) ./configure --prefix=/usr/local
(sudo) make
make altinstall

change the link
mv /usr/bin/python /usr/bin/python2.7.5 #or other version you already installed
ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python

to correct the config of 'yum'
we have to
1.change first line in '/usr/bin/yum' to '#!/usr/bin/python2.7'
2.change first line in '/usr/libexec/urlgrabber-ext-down' to '#!/usr/bin/python2.7'
Find all posts by this user
Quote this message in a reply
05-31-2018, 11:44 AM
Post: #2
RE: change python version
pls kindly review whether there is need to pack code into a script
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump: