CentOS 6.8 python升級

來源:互聯網
上載者:User

標籤:gpo   軟串連   下載   解決   檔案頭部   tar   下載安裝   .gz   解壓縮   

1.查看當前python版本

python -V
python 2.6.6

2.下載Python-2.7.12
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz

3.解壓縮並更改工作目錄

tar zxvf Python-2.7.12.tgz

cd Python-2.7.12

4.安裝

./configure
make all
make install
make clean
make disclean

5.查看版本資訊
/usr/local/bin/python2.7 -V

6.建立軟串連,使系統預設的python指向python2.7
mv /usr/bin/python /usr/bin/python2.6.6 #備份
ln -s /usr/local/bin/python2.7 /usr/bin/python # 建立軟串連

7.重新檢驗Python版本

python -V


8.指定yum的Python版本
由於系統python軟串連指向python2.7之後,yum將無法正常工作,出現“No module named yum”的報錯。
解決方式如下:
vim /usr/bin/yum

將檔案頭部的
#!/usr/bin/python
改為

#!/usr/bin/python2.6.6


安裝setuptools和pip

1.下載安裝ez.setup.py
wget https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py install

2.下載安裝pip

tar -zxvf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install

CentOS 6.8 python升級

聯繫我們

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