[CentOS]安裝python2.75 設定為預設版本

來源:互聯網
上載者:User
1 centos安裝python2.75  (centos6.3)

     1 切換到root使用者     2 下載tar包 
           wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
     3  安裝
          tar -zxvf Python-2.7.5.tgz          cd Python-2.7.5          ./configure --prefix=/usr/local/python27          make&&make install

      4 測試下安裝好了麼

          /usr/local/python27/bin/python 
          可以看到python可以使用了 版本是2.7.5     5 
設定軟體連結
 ln -s /usr/local/python27/bin/python /usr/bin/python27
          以後就可以直接使用 python27來使用2.7.5版本了     2 設定為預設的版本
     mv /usr/bin/python /usr/bin/python-old     ln -s /usr/local/python27/bin/python /usr/bin/python
     再測試一下:
     [root@bogon Python-2.7.5]# python       Python 2.7.5 (default, Jul 22 2013, 22:14:28)      [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2      Type "help", "copyright", "credits" or "license" for more information.
     這樣在使用yum的時候會發現報錯了     從新配置下yum 
  vim /usr/bin/yum
     把第一行修改為:#!/usr/bin/python-old     再次輸入yum 發現可以正常顯示了
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.