Ubuntu 13.04安裝pyenv: Simple Python version management

pyenv: https://github.com/yyuu/pyenv
pyenv-virtualenv: https://github.com/yyuu/pyenv-virtualenv
安裝相關套件(https://github.com/yyuu/pyenv/wiki/Common-build-problems):

// zlib
$ sudo apt-get install libssl-dev zlib1g-dev
// bzip2
$ sudo apt-get install libbz2-dev
// Readline support
$ sudo apt-get install libreadline-dev
// SQLite
$ sudo apt-get install libsqlite3-dev

安裝主程式:

// 必須先安裝 git
$ cd
$ git clone git://github.com/yyuu/pyenv.git .pyenv
$ echo ‘export PYENV_ROOT=”$HOME/.pyenv”’ » ~/.bashrc
$ echo ‘export PATH=”$PYENV_ROOT/bin:$PATH”’ » ~/.bashrc
$ echo ‘eval “$(pyenv init -)”’ » ~/.bashrc
$ exec $SHELL
$ pyenv install 2.7.5
$ pyenv rehash

安裝pyenv-virtualenv (https://github.com/yyuu/pyenv-virtualenv):

$ git clone git://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

如果發生 BUILD FAILED 錯誤,則安裝 make 套件:

sudo apt-get install make

安裝 pyenv-virtualenv plugin:

git clone git://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv