Linux下安裝或升級Python 2.7
阿新 • • 發佈:2017-10-18
版本 結果 http ins order 地址 ber 目錄 name
1.準備編譯環境gcc
2.去官網下載要安裝的對應版本的python的源代碼
下載地址:https://www.python.org/downloads/source/
你可以選擇你要下載的版本,用wget指令來下載相應的源代碼
3.解壓下載的代碼包
1 2 |
tar -zxvf Python-x.x.x.tgz
cd Python-x.x.x
|
4.配置
1)查找configure文件
1 2 |
find . -name configure
cd 搜索結果(一般就在Python文件根目錄下) |
2)進行配置
1 |
. /configure
|
5.編譯
1 2 |
make
make install
|
(如果沒有其他特殊需求,安裝就到此結束了,輸入pythonx.x即可以進入你剛剛安裝的python開發環境)
6.替換以前的python默認版本(創建新的軟連接)
1 2 3 |
cd /usr/bin/
rm -rf python
ln -s /usr/local/Python-x .x.x /bin/python . /python
|
Linux下安裝或升級Python 2.7