繁体   English   中英

如何更改默认的python路径?

[英]How to change the default python path?

我在更改python版本时遇到问题,我使用的是centos6,我需要将python版本从2.6更改为2.7。

[root@master Downloads]# which python
/usr/bin/python
[root@master Downloads]# which python2.7
/usr/local/bin/python2.7

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

现在我的系统是这样的:

$ 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指出的那样。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM