2013-06-22 113 views
0

我有一个更改python版本的问题,我使用的是centos6,我需要将python版本从2.6更改为2.7。如何更改默认的python路径?

[[email protected] Downloads]# which python 
/usr/bin/python 
[[email protected] Downloads]# which python2.7 
/usr/local/bin/python2.7 

我该如何使用python2.7作为默认值,或将python的路径更改为2.7?

+2

除非你想削弱你的系统,否则你不会。 –

+4

请考虑使用virtualenv(和virtualenvwrapper)。 –

+0

我无法安装nltk 2.7,我需要使用2.7作为默认,但很多系统包依赖于2.6。 – rosnikv

回答

0

现在我的系统是这样的:

$ ls -la /usr/bin/python 
lrwxrwxrwx. 1 root root 7 Oct 1 2012 /usr/bin/python -> python2 
$ ls -la /usr/bin/python2 
lrwxrwxrwx. 1 root root 9 Oct 1 2012 /usr/bin/python2 -> python2.7 
$ ls -la /usr/bin/python2.7 
-rwxr-xr-x. 1 root root 10768 Jul 24 2012 /usr/bin/python2.7 

你要做到这一点,我认为:

sudo rm /usr/bin/python 
sudo ln -s /usr/bin/python2.7 /usr/bin/python 

这样/usr/bin/python -> /usr/bin/python2.7

但我不能用yum和更新我的系统正如Klaus Warzecha指出的那样。