本文介紹了如何在 CentOS 上將 Python3.5.2 設置為默認 Python 版本?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
有沒有辦法將 Python 3.5.2 設置為 CentOS 7 上的默認 Python 版本?目前,我默認安裝了 Python 2.7,并單獨安裝了 Python 3.5.2.
Is there a way to set the Python 3.5.2 as the default Python version on CentOS 7? currently, I have Python 2.7 installed as default and Python 3.5.2 installed separately.
我使用了以下命令
mv /usr/bin/python /usr/bin/python-old
sudo ln -fs /usr/bin/python3 /usr/bin/python
但在那之后 yum
給出了錯誤.
but after that yum
gives the error.
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
這里有什么我遺漏的嗎?
is there something I'm missing here?
注意:它與 Linux CentOS 7,如何設置Python2.7為默認Python版本?
推薦答案
如果這樣
sudo ln -fs /usr/bin/python3.5 /usr/bin/python
不起作用(它應該)
您可以使用以下命令將別名添加到您的 /home/.bashrc
:
you could just add an alias into your /home/.bashrc
with this command:
alias python="/usr/bin/python3.5"
如果這不起作用,您應該只使用虛擬環境.閱讀此頁面開始.
and if this does not work either you should just use virtual env. Read this page to get started.
這篇關于如何在 CentOS 上將 Python3.5.2 設置為默認 Python 版本?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!