手元のMacBook Proにpythonbrewとvenvを使ってPython開発環境を構築しました。
環境構築手順
$ pythonbrew install 2.7.2 3.2
特定のバージョンを有効化するにはswitchコマンドを使用します。
$ pybrew switch 2.7.2
仮想環境を作成します。
作成された仮想環境は使用中のバージョンに紐付けられます。
$ pybrew venv create py272
使用中のバージョンに紐付いた仮想環境を表示します。
$ pybrew venv list
# virtualenv for Python-2.7.2 (found in /Users/tetsuyai/.pythonbrew/venvs/Python-2.7.2)
py272
仮想環境をすべて表示するには-aオプションを追加します。
$ pybrew venv list -a
# virtualenv for Python-2.7.2 (found in /Users/tetsuyai/.pythonbrew/venvs/Python-2.7.2)
py272
# virtualenv for Python-3.2 (found in /Users/tetsuyai/.pythonbrew/venvs/Python-3.2)
py32
仮想環境を選択します。
$ pythonbrew venv use py272
# Using `py272` environment (found in /Users/tetsuyai/.pythonbrew/venvs/Python-2.7.2)
# To leave an environment, simply run `deactivate`
選択した仮想環境を終了します。
$ deactivate
いらなくなった仮想環境は削除しましょう。
$ pythonbrew venv delete py272
Deleting `py272` environment in /Users/tetsuyai/.pythonbrew/venvs/Python-2.7.2