centos6 內建python2.6升級python2.7+

來源:互聯網
上載者:User

標籤:div   org   ice   orm   code   設定   red   python3   col   

centos6系統內建Python為2.6.6版本,升級搞版本操作如下(python2-python3都一樣)

1.下載需要升級的python包

官方:https://www.python.org/downloads/

2.下載後解壓

tar  xf python-x.x.x-tar.gz

cd Python-x.x.x

3.編譯安裝

./configure

make && make install

echo $?  如果返回碼為0,表示沒有錯誤,安裝成功

4.設定系統使用新安裝python版本

備份原有python

mv /usr/bin/python /usr/bin/python2.6.old

連結新版本python

ln -s /usr/local/bin/python3.5 /usr/bin/python

5.執行python命令

[[email protected] Python-3.5.0]# pythonPython 3.5.0 (default, Sep  9 2018, 19:09:38) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> exit()

查看版本資訊,已變,安裝成功

6.升級完成後會導致yum不可以用,

解決方案:

編譯/usr/bin/yum

將/usr/bin/python 改為/usr/bin/python2.6即可

centos6 內建python2.6升級python2.7+

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.