強火で進め

このブログではプログラム関連の記事を中心に書いてます。

MacPortsでPythonのバージョンを切り替える方法

以前、 python_select で使用するPythonのバージョンを切り替える方法を紹介しましたが今日切り替えようとした所、上手く行きませんでした。

MacPortsでデフォルトで使用するPythonのバージョンを切り替える方法 - 強火で進め
http://d.hatena.ne.jp/nakamura001/20101228/1293554200

試しにMacPortsのバージョン切り替え機能を使ったら上手く行ったの手順をメモしておきます。

手順

インストール済みの python を確認。

$ port select --list python
Available versions for python:
	none
	python24
	python25-apple
	python26
	python26-apple (active)
	python27

さっきので python26-apple (active) ってなってましたが念の為に現在、有効になっている python を確認。

$ port select --show python
The currently selected version for 'python' is 'python26-apple'.

python27 に切り替える。

sudo port select --set python python27
Selecting 'python27' for 'python' succeeded. 'python27' is now active.

切り替わっている事を確認。

$ port select --list python
Available versions for python:
	none
	python24
	python25-apple
	python26
	python26-apple
	python27 (active)