Brana
Brana

Reputation: 1239

Making 2.7.3 default version of python on CentOS 6

I want to execute python from php and I do have a script that works fine for default python interpreter. I have centos with default python 2.6.6 which is installed at /usr/bin/python and python 2.7.3 which is installed at /usr/local/bin/python2.7. You can see what is the default python version:

[root@me ~]# python -V
Python 2.6.6

[root@me ~]# python2.7 -V
Python 2.7.3

How do I make python 2.7.3 default python on my OS. So when i run python -V i should get 2.7.3?

I know it is bad. The alternative is to uninstall python 2.7.3 and I do not know how to do this.

Upvotes: 2

Views: 4298

Answers (1)

Shahrukh Khan
Shahrukh Khan

Reputation: 316

Execute the below commands to make yum work as well as python2.7

echo "export PATH="/usr/local/bin:$PATH"" >> /etc/profile
source /etc/profile
mv /usr/bin/python /usr/bin/python.bak
update-alternatives --install /usr/bin/python python /usr/bin/python2.6 1
update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 2
update-alternatives --config python
sed -i "s/python/python2.6/g" /usr/bin/yum

Upvotes: 1

Related Questions