タイトルそのままですがpython利用しようかと手持ちの環境を調べたら
バージョンが2.4.3(CentOS release 5.7)
これは古過ぎなので最新版を入れたい。でもpythonはyumなどが利用してるので普通に入れ替えちゃうといろいろ影響がある。
なので既存の環境を壊さないでなんとかならないかと探していたら見つけました。
pythonbrew
https://github.com/utahta/pythonbrew
これでpythonのバージョンを簡単に切り替えて利用できそうです。
pythonbrewのインストール
githubにある通りにインストール
$ curl -kL http://xrl.us/pythonbrewinstall | bash
~/.bashrcに下記を追加
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
$ pythonbrew version 1.1
で完了。
python 2.7.2のインストール
$ pythonbrew install --force 2.7.2 Downloading Python-2.7.2.tgz as /home/[hoge]/.pythonbrew/dists/Python-2.7.2.tgz ######################################################################## 100.0% Extracting Python-2.7.2.tgz into /home/[hoge]/.pythonbrew/build/Python-2.7.2 This could take a while. You can run the following command on another shell to track the status: tail -f /home/[hoge]/.pythonbrew/log/build.log Installing Python-2.7.2 into /home/[hoge]/.pythonbrew/pythons/Python-2.7.2 Downloading distribute_setup.py as /home/[hoge]/.pythonbrew/dists/distribute_setup.py ######################################################################## 100.0% Installing distribute into /home/[hoge]/.pythonbrew/pythons/Python-2.7.2 Installing pip into /home/[hoge]/.pythonbrew/pythons/Python-2.7.2 Installed Python-2.7.2 successfully. Run the following command to switch to Python-2.7.2. pythonbrew switch 2.7.2
すごく時間がかかるのでメッセージの通り、tailでbuild.logを参照した方が安心できます。
別に時間が短くなる訳ではないですけど。
インストールできたので確認してみます。
$ python -V Python 2.4.3 $ pythonbrew switch 2.7.2 Switched to Python-2.7.2 $ python -V Python 2.7.2
簡単ですね。