お次はpython。ってpython使ったことないんだけどね。。
これを機に使いたいねって思って。まずはデフォルトのバージョン確認
$ python
Python 2.6.1 (r261:67515, Dec 17 2009, 00:59:15)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
pythonを終了させるには「exit()」コマンドをタイプすればOK。
portsの確認
$ port search python
・・・
python24 @2.4.6 (lang)
An interpreted, object-oriented programming language
python24-doc @2.4.4 (lang)
HTML documentation for Python 2.4
python25 @2.5.5 (lang)
An interpreted, object-oriented programming language
python25-doc @2.5.2 (lang)
HTML documentation for Python 2.5
python26 @2.6.6 (lang)
An interpreted, object-oriented programming language
python26-doc @2.6.4 (lang)
HTML documentation for Python 2.6
python27 @2.7 (lang)
An interpreted, object-oriented programming language
python31 @3.1.2 (lang)
An interpreted, object-oriented programming language
python32 @3.2a3 (lang)
An interpreted, object-oriented programming language
python_select @0.3 (sysutils)
Switch the default python interpreter
・・・
いっぱいあるね〜。
とりあえず3.2系をインストールしてpython_selectで切り替えられるようにしておけば何とかなるかな?ってことで、インストール
$ sudo port install python32
Password:
・・・
---> Fetching python26
---> Attempting to fetch Python-2.6.6.tar.bz2 from http://distfiles.macports.org/python26
---> Verifying checksum(s) for python26
---> Extracting python26
---> Applying patches to python26
---> Configuring python26
---> Building python26
---> Staging python26 into destroot
---> Installing python26 @2.6.6_0+no_tkinter
---> Activating python26 @2.6.6_0+no_tkinter
To fully complete your installation and make python 2.6 the default, please
run:
sudo port install python_select
sudo python_select python26
・・・
---> Fetching python32
---> Attempting to fetch Python-3.2a3.tar.bz2 from http://distfiles.macports.org/python32
---> Verifying checksum(s) for python32
---> Extracting python32
---> Applying patches to python32
---> Configuring python32
---> Building python32
Error: Target org.macports.build returned: shell command failed
Log for python32 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python32/main.log
Error: Status 1 encountered during processing.
To report a bug, see
なんかたくさんインストールされた。。2.6系もインストールされたっぽい。
そしてpython_selectをインストールせよと。
最後の最後でpython32ビルドできなかったって(T_T)
インストールされたものを確認。
$ port installed
・・・
python26 @2.6.6_0+no_tkinter (active)
・・・
とりあえず、python_selectをインストールしてみることに。
$ sudo port install python_select
よくよく考えてみると、3.2系はまだdjangoがない。ということで、2.7系をインストールしてみる。
$ sudo port install python27
今度は無事インストールされたみたい^^
python_select で2.7系に変更
$ sudo python_select python27
Selecting version "python27" for python
ターミナルを再起動してバージョン確認。
$ python
Python 2.7 (r27:82500, Nov 6 2010, 18:41:20)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
参考サイト:MacPortsを使って、Pythonの開発環境を整えてみた