MacでPython 3を使う

2012-11-19 (月) 17:05:20 (4167d) | Topic path: Top / その他 / MacでPython 3を使う

はじめに

Python 3をソースコードからMacのOS X (Mountain Lion) にインストールする方法です.

以下の環境で確認しました.

  • OS X 10.8.2 (Mountain Lion)
  • Python 3.3.0

必要なもの

  • Xcode
  • Xcode command line tools

ダウンロード

Pythonの公式サイトからソースコードをダウンロードします.

インストール

ダウンロードしたファイルを展開したディレクトリーで次のように実行します.

./configure
make
make test
sudo make install

ちなみに,make testしたときに次のようなエラーが出ましたが,無視しました.

FAILED (failures=1, skipped=1)
test test_urllib2net failed
make: *** [test] Error 1

動作確認

python3
Python 3.3.0 (default, Nov 19 2012, 16:46:29) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>

インストーラーを使ってインストールする

以下は,以前にPython 3をOS X用のインストーラを使ってインストールしたときの記事です.

この内容は,Mac OS X 10.7.4とPython 3.2.3で確認しました.

必要なもの

とくになし.

ダウンロード

Pythonの公式サイトからPython 3.2.3 Mac OS X 64-bit/32-bit x86-64/i386 Installerをダウンロードします.

インストール

ダウンロードしたディスク・イメージをダブル・クリックしてマウントし,インストーラーを起動するだけです.

動作確認

ターミナルでPython 3を起動します.

$ python3
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
トップ   編集 凍結解除 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS