Butchered my python - 如何修改多个安装的默认python版本?

时间:2015-11-25 00:17:54

标签: python linux centos environment-variables

我建议将我的python升级到2.7.10的应用程序,我已经安装了2.7.5并运行了CentOS 7.我做了一个糟糕的选择来遵循本指南(http://tecadmin.net/install-python-2-7-on-centos-rhel/#)但安装了make altinstall,刚刚安装make,因为我以为我想升级我当前的版本。现在一些系统应用程序(yum)不再起作用。如何将路径更改回/ usr / bin / python而不是/ usr / local / bin / python?

[root@host ~]# which python
/usr/local/bin/python
[root@host ~]# /usr/local/bin/python -V
Python 2.7.10
[root@host ~]# ls -lth /usr/bin/python
lrwxrwxrwx. 1 root root 16 Nov 24 19:03 /usr/bin/python -> /usr/bin/python2
[root@host ~]# ls -lth /usr/bin/python2
lrwxrwxrwx. 1 root root 9 Nov 22 22:42 /usr/bin/python2 -> python2.7
[root@host ~]# ls -lth /usr/bin/python2.7
-rwxr-xr-x. 1 root root 7.0K Jun 23 20:42 /usr/bin/python2.7
[root@host ~]# /usr/bin/python2.7 -V
Python 2.7.5
[root@host logs]# ls -lth /etc/environment 
-rw-r--r--. 1 root root 0 Oct 29  2014 /etc/environment
[root@host logs]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

1 个答案:

答案 0 :(得分:0)

运行echo $PATH。您应该看到它包含usr / local / bin / python的位置而不是/ usr / bin / python。检查 etc / environment 文件以确保您的PATH正确无误。