bad interpreter: Permission denied

-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.

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容