2015年1月22日 星期四

Ubuntu 安裝舊版本的 python

1. 下載並安裝 pythonbrew
curl -kL0 http://github.com/utahta/pythonbrew/raw/master/pythonbrew-install  > ./pythonup.sh
chmod  777 pythonup.sh
./pythonup.sh

2. 安裝 python 2.6.6 與 python 2.7.3
pythonbrew install 2.6.6
pythonbrew install 2.7.3

3. 切換python 版本 (需重登, relogin)
pythonbrew switch 2.6.6
pythonbrew switch 2.7.3

4. 測試目前使用版本
python --version


註1: 安裝會使用到以下網域, 留意是否有被防火牆擋掉
github.com
www.python.org
raw.githubuserontent.com
pypi.python.org

註2: pythonbrew 安裝目錄
用 root 安裝, 會安裝到 /usr/local/pythonbrew
 用其它帳號, 會安裝到 $HOME/.pythonbrew
所以需要export PATH
如:  export PATH=$PATH:/usr/local/pythonbrew/bin
   或 export PATH=$PATH:$HOME/.pythonbrew/bin


沒有留言:

張貼留言