pythonbrewでpythonのバージョン管理をする
Rubyのrvm、PerlのPerlbrewなど各々の言語のバージョンを管理してくれるツールは、とても有難いものです。
今日は、そのPython版ともいえるpythonbrewをインストールしたいと思います。pythonbrewは@utahtaさんが作られたバージョン管理ツールでperlbrewをパクったと同じ思想なツール、だそうです。使おうと思った経緯は、GAEがやりたくて、という単純なものです。
環境
- macbookpro Early 2011
- OS Lion
pythonbrewのインストール
$ curl -kL http://xrl.us/pythonbrewinstall | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2799 100 2799 0 0 2227 0 0:00:01 0:00:01 --:--:-- 14280 Downloading http://pypi.python.org/packages/source/p/pythonbrew/pythonbrew-1.1.tar.gz ######################################################################## 100.0% Extracting /Users/hoge/.pythonbrew/dists/pythonbrew-1.1.tar.gz Installing pythonbrew into /Users/hoge/.pythonbrew Well-done! Congratulations! The pythonbrew is installed as: /Users/hoge/.pythonbrew Please add the following line to the end of your ~/.bashrc source /Users/hoge/.pythonbrew/etc/bashrc After that, exit this shell, start a new one, and install some fresh pythons: pythonbrew install 2.7.2 pythonbrew install 3.2 For further instructions, run: pythonbrew help The default help messages will popup and tell you what to do! Enjoy pythonbrew at /Users/hoge/.pythonbrew!!
$ [[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
pyhonのインストール
pybrew install -f 2.6.6 3.2
make testで失敗してインストールできないので、forceオプションをつける。
$ pythonbrew list # pythonbrew pythons Python-2.6.6 (*) Python-3.2
入った。
pythonbrewのコマンドオプションなどは、作者様のサイトやGithubに詳細がありますので、割愛します。
皆さん、良いお年を。