-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: Permission denied
最近更新了CentOS的python的版本。结果用yum的命令的时候出现了上述的错误。在网上找到了解释。
随记录一下。
在更新python的时候需要建立新的连接文件
sudo ln -s /usr/bin/python3.4 /usr/bin/python.
但是在CentOS中,/usr/bin/python.只能指向python2.6.所以如果要解决这个问题就要
sudo rm -rf /usr/bin/python
sudo ln -s /usr/bin/python2.6 /usr/bin/python
to at least fix that part of it. Next time you're building Python, use the defaults and install it to /usr/local/bin, not /usr/bin. That's what the /usr/local hierarchy is for - user-installed programs. /usr and /usr/bin should only be for system-installed programs (such as those installed by yum or its graphical equivalents), and you should keep out unless you know what you're doing. To use identically-named programs in /usr/local/bin instead of their counterparts in /usr/bin, open your ~/.bashrc or ~/.bash_profile (whichever your system uses) and add the following as the last line:
export PATH=/usr/local/bin:$PATH
Restart your shell session, and you should be all set.