mac の開発環境構築 〜python〜

方針

お次はpython。って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
・・・

いっぱいあるね〜。

pythonをインストール

とりあえず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 <http://guide.macports.org/#project.tickets>

なんかたくさんインストールされた。。2.6系もインストールされたっぽい。

そしてpython_selectをインストールせよと。

最後の最後でpython32ビルドできなかったって(T_T)?

インストールされたものを確認。

$ port installed
・・・
python26 @2.6.6_0+no_tkinter (active)
・・・

python_selectをインストール

とりあえず、python_selectをインストールしてみることに。

$ sudo port install python_select

python2.7系をインストール

よくよく考えてみると、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の開発環境を整えてみた

各種インストールログ

python32インストールログ

$ sudo port install python32
Password:
--->  Computing dependencies for python32
--->  Dependencies to be installed: gdbm tk Xft2 fontconfig xrender xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python26 xorg-libpthread-stubs xorg-xcb-proto xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-renderproto tcl xorg-libXScrnSaver xorg-libXext xorg-scrnsaverproto
--->  Fetching gdbm
--->  Attempting to fetch gdbm-1.8.3.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gdbm
--->  Verifying checksum(s) for gdbm
--->  Extracting gdbm
--->  Configuring gdbm
--->  Building gdbm
--->  Staging gdbm into destroot
--->  Installing gdbm @1.8.3_2
--->  Activating gdbm @1.8.3_2
--->  Cleaning gdbm
--->  Fetching fontconfig
--->  Attempting to fetch fontconfig-2.8.0.tar.gz from http://distfiles.macports.org/fontconfig
--->  Verifying checksum(s) for fontconfig
--->  Extracting fontconfig
--->  Applying patches to fontconfig
--->  Configuring fontconfig
--->  Building fontconfig
--->  Staging fontconfig into destroot
--->  Installing fontconfig @2.8.0_0
--->  Activating fontconfig @2.8.0_0
--->  Cleaning fontconfig
--->  Fetching xorg-bigreqsproto
--->  Attempting to fetch bigreqsproto-1.1.1.tar.bz2 from http://distfiles.macports.org/xorg-bigreqsproto
--->  Verifying checksum(s) for xorg-bigreqsproto
--->  Extracting xorg-bigreqsproto
--->  Configuring xorg-bigreqsproto
--->  Building xorg-bigreqsproto
--->  Staging xorg-bigreqsproto into destroot
--->  Installing xorg-bigreqsproto @1.1.1_0
--->  Activating xorg-bigreqsproto @1.1.1_0
--->  Cleaning xorg-bigreqsproto
--->  Fetching xorg-inputproto
--->  Attempting to fetch inputproto-2.0.tar.bz2 from http://distfiles.macports.org/xorg-inputproto
--->  Verifying checksum(s) for xorg-inputproto
--->  Extracting xorg-inputproto
--->  Configuring xorg-inputproto
--->  Building xorg-inputproto
--->  Staging xorg-inputproto into destroot
--->  Installing xorg-inputproto @2.0_0
--->  Activating xorg-inputproto @2.0_0
--->  Cleaning xorg-inputproto
--->  Fetching xorg-kbproto
--->  Attempting to fetch kbproto-1.0.5.tar.bz2 from http://distfiles.macports.org/xorg-kbproto
--->  Verifying checksum(s) for xorg-kbproto
--->  Extracting xorg-kbproto
--->  Configuring xorg-kbproto
--->  Building xorg-kbproto
--->  Staging xorg-kbproto into destroot
--->  Installing xorg-kbproto @1.0.5_0
--->  Activating xorg-kbproto @1.0.5_0
--->  Cleaning xorg-kbproto
--->  Fetching xorg-xproto
--->  Attempting to fetch xproto-7.0.19.tar.bz2 from http://distfiles.macports.org/xorg-xproto
--->  Verifying checksum(s) for xorg-xproto
--->  Extracting xorg-xproto
--->  Configuring xorg-xproto
--->  Building xorg-xproto
--->  Staging xorg-xproto into destroot
--->  Installing xorg-xproto @7.0.19_0
--->  Activating xorg-xproto @7.0.19_0
--->  Cleaning xorg-xproto
--->  Fetching xorg-libXau
--->  Attempting to fetch libXau-1.0.6.tar.bz2 from http://distfiles.macports.org/xorg-libXau
--->  Verifying checksum(s) for xorg-libXau
--->  Extracting xorg-libXau
--->  Configuring xorg-libXau
--->  Building xorg-libXau
--->  Staging xorg-libXau into destroot
--->  Installing xorg-libXau @1.0.6_0
--->  Activating xorg-libXau @1.0.6_0
--->  Cleaning xorg-libXau
--->  Fetching xorg-libXdmcp
--->  Attempting to fetch libXdmcp-1.1.0.tar.bz2 from http://distfiles.macports.org/xorg-libXdmcp
--->  Verifying checksum(s) for xorg-libXdmcp
--->  Extracting xorg-libXdmcp
--->  Configuring xorg-libXdmcp
--->  Building xorg-libXdmcp
--->  Staging xorg-libXdmcp into destroot
--->  Installing xorg-libXdmcp @1.1.0_0
--->  Activating xorg-libXdmcp @1.1.0_0
--->  Cleaning xorg-libXdmcp
--->  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

--->  Cleaning python26
--->  Fetching xorg-libpthread-stubs
--->  Attempting to fetch libpthread-stubs-0.3.tar.bz2 from http://distfiles.macports.org/xorg-libpthread-stubs
--->  Verifying checksum(s) for xorg-libpthread-stubs
--->  Extracting xorg-libpthread-stubs
--->  Configuring xorg-libpthread-stubs
--->  Building xorg-libpthread-stubs
--->  Staging xorg-libpthread-stubs into destroot
--->  Installing xorg-libpthread-stubs @0.3_0
--->  Activating xorg-libpthread-stubs @0.3_0
--->  Cleaning xorg-libpthread-stubs
--->  Fetching xorg-xcb-proto
--->  Attempting to fetch xcb-proto-1.6.tar.bz2 from http://distfiles.macports.org/xorg-xcb-proto
--->  Verifying checksum(s) for xorg-xcb-proto
--->  Extracting xorg-xcb-proto
--->  Configuring xorg-xcb-proto
--->  Building xorg-xcb-proto
--->  Staging xorg-xcb-proto into destroot
--->  Installing xorg-xcb-proto @1.6_0+python26
--->  Activating xorg-xcb-proto @1.6_0+python26
--->  Cleaning xorg-xcb-proto
--->  Fetching xorg-libxcb
--->  Attempting to fetch libxcb-1.7.tar.bz2 from http://distfiles.macports.org/xorg-libxcb
--->  Verifying checksum(s) for xorg-libxcb
--->  Extracting xorg-libxcb
--->  Configuring xorg-libxcb
--->  Building xorg-libxcb
--->  Staging xorg-libxcb into destroot
--->  Installing xorg-libxcb @1.7_0+python26
--->  Activating xorg-libxcb @1.7_0+python26
--->  Cleaning xorg-libxcb
--->  Fetching xorg-util-macros
--->  Attempting to fetch util-macros-1.11.0.tar.bz2 from http://distfiles.macports.org/xorg-util-macros
--->  Verifying checksum(s) for xorg-util-macros
--->  Extracting xorg-util-macros
--->  Configuring xorg-util-macros
--->  Building xorg-util-macros
--->  Staging xorg-util-macros into destroot
--->  Installing xorg-util-macros @1.11.0_0
--->  Activating xorg-util-macros @1.11.0_0
--->  Cleaning xorg-util-macros
--->  Fetching xorg-xcmiscproto
--->  Attempting to fetch xcmiscproto-1.2.1.tar.bz2 from http://distfiles.macports.org/xorg-xcmiscproto
--->  Verifying checksum(s) for xorg-xcmiscproto
--->  Extracting xorg-xcmiscproto
--->  Configuring xorg-xcmiscproto
--->  Building xorg-xcmiscproto
--->  Staging xorg-xcmiscproto into destroot
--->  Installing xorg-xcmiscproto @1.2.1_0
--->  Activating xorg-xcmiscproto @1.2.1_0
--->  Cleaning xorg-xcmiscproto
--->  Fetching xorg-xextproto
--->  Attempting to fetch xextproto-7.1.2.tar.bz2 from http://distfiles.macports.org/xorg-xextproto
--->  Verifying checksum(s) for xorg-xextproto
--->  Extracting xorg-xextproto
--->  Configuring xorg-xextproto
--->  Building xorg-xextproto
--->  Staging xorg-xextproto into destroot
--->  Installing xorg-xextproto @7.1.2_0
--->  Activating xorg-xextproto @7.1.2_0
--->  Cleaning xorg-xextproto
--->  Fetching xorg-xf86bigfontproto
--->  Attempting to fetch xf86bigfontproto-1.2.0.tar.bz2 from http://distfiles.macports.org/xorg-xf86bigfontproto
--->  Verifying checksum(s) for xorg-xf86bigfontproto
--->  Extracting xorg-xf86bigfontproto
--->  Configuring xorg-xf86bigfontproto
--->  Building xorg-xf86bigfontproto
--->  Staging xorg-xf86bigfontproto into destroot
--->  Installing xorg-xf86bigfontproto @1.2.0_0
--->  Activating xorg-xf86bigfontproto @1.2.0_0
--->  Cleaning xorg-xf86bigfontproto
--->  Fetching xorg-xtrans
--->  Attempting to fetch xtrans-1.2.5.tar.bz2 from http://distfiles.macports.org/xorg-xtrans
--->  Verifying checksum(s) for xorg-xtrans
--->  Extracting xorg-xtrans
--->  Configuring xorg-xtrans
--->  Building xorg-xtrans
--->  Staging xorg-xtrans into destroot
--->  Installing xorg-xtrans @1.2.5_0
--->  Activating xorg-xtrans @1.2.5_0
--->  Cleaning xorg-xtrans
--->  Fetching xorg-libX11
--->  Attempting to fetch libX11-1.3.6.tar.bz2 from http://distfiles.macports.org/xorg-libX11
--->  Verifying checksum(s) for xorg-libX11
--->  Extracting xorg-libX11
--->  Applying patches to xorg-libX11
--->  Configuring xorg-libX11
--->  Building xorg-libX11
--->  Staging xorg-libX11 into destroot
--->  Installing xorg-libX11 @1.3.6_1
--->  Activating xorg-libX11 @1.3.6_1
--->  Cleaning xorg-libX11
--->  Fetching xorg-renderproto
--->  Attempting to fetch renderproto-0.11.1.tar.bz2 from http://distfiles.macports.org/xorg-renderproto
--->  Verifying checksum(s) for xorg-renderproto
--->  Extracting xorg-renderproto
--->  Configuring xorg-renderproto
--->  Building xorg-renderproto
--->  Staging xorg-renderproto into destroot
--->  Installing xorg-renderproto @0.11.1_0
--->  Activating xorg-renderproto @0.11.1_0
--->  Cleaning xorg-renderproto
--->  Fetching xrender
--->  Attempting to fetch libXrender-0.9.6.tar.bz2 from http://distfiles.macports.org/xrender
--->  Verifying checksum(s) for xrender
--->  Extracting xrender
--->  Configuring xrender
--->  Building xrender
--->  Staging xrender into destroot
--->  Installing xrender @0.9.6_0
--->  Activating xrender @0.9.6_0
--->  Cleaning xrender
--->  Fetching Xft2
--->  Attempting to fetch libXft-2.2.0.tar.bz2 from http://distfiles.macports.org/Xft2
--->  Verifying checksum(s) for Xft2
--->  Extracting Xft2
--->  Configuring Xft2
--->  Building Xft2
--->  Staging Xft2 into destroot
--->  Installing Xft2 @2.2.0_0
--->  Activating Xft2 @2.2.0_0
--->  Cleaning Xft2
--->  Fetching tcl
--->  Attempting to fetch tcl8.5.9-src.tar.gz from http://jaist.dl.sourceforge.net/tcl
--->  Verifying checksum(s) for tcl
--->  Extracting tcl
--->  Configuring tcl
--->  Building tcl
--->  Staging tcl into destroot
--->  Installing tcl @8.5.9_0
--->  Activating tcl @8.5.9_0
--->  Cleaning tcl
--->  Fetching xorg-libXext
--->  Attempting to fetch libXext-1.2.0.tar.bz2 from http://distfiles.macports.org/xorg-libXext
--->  Verifying checksum(s) for xorg-libXext
--->  Extracting xorg-libXext
--->  Configuring xorg-libXext
--->  Building xorg-libXext
--->  Staging xorg-libXext into destroot
--->  Installing xorg-libXext @1.2.0_0
--->  Activating xorg-libXext @1.2.0_0
--->  Cleaning xorg-libXext
--->  Fetching xorg-scrnsaverproto
--->  Attempting to fetch scrnsaverproto-1.2.1.tar.bz2 from http://distfiles.macports.org/xorg-scrnsaverproto
--->  Verifying checksum(s) for xorg-scrnsaverproto
--->  Extracting xorg-scrnsaverproto
--->  Configuring xorg-scrnsaverproto
--->  Building xorg-scrnsaverproto
--->  Staging xorg-scrnsaverproto into destroot
--->  Installing xorg-scrnsaverproto @1.2.1_0
--->  Activating xorg-scrnsaverproto @1.2.1_0
--->  Cleaning xorg-scrnsaverproto
--->  Fetching xorg-libXScrnSaver
--->  Attempting to fetch libXScrnSaver-1.2.1.tar.bz2 from http://distfiles.macports.org/xorg-libXScrnSaver
--->  Verifying checksum(s) for xorg-libXScrnSaver
--->  Extracting xorg-libXScrnSaver
--->  Configuring xorg-libXScrnSaver
--->  Building xorg-libXScrnSaver
--->  Staging xorg-libXScrnSaver into destroot
--->  Installing xorg-libXScrnSaver @1.2.1_0
--->  Activating xorg-libXScrnSaver @1.2.1_0
--->  Cleaning xorg-libXScrnSaver
--->  Fetching tk
--->  Attempting to fetch tk8.5.9-src.tar.gz from http://jaist.dl.sourceforge.net/tcl
--->  Verifying checksum(s) for tk
--->  Extracting tk
--->  Configuring tk
--->  Building tk
--->  Staging tk into destroot
--->  Installing tk @8.5.9_0
--->  Activating tk @8.5.9_0
--->  Cleaning tk
--->  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 

python_select インストールログ

$ sudo port install python_select
Password:
--->  Computing dependencies for python_select
--->  Fetching python_select
--->  Attempting to fetch select-0.3.tar.gz from http://svn.macports.org/repository/macports/contrib/select/
--->  Verifying checksum(s) for python_select
--->  Extracting python_select
--->  Configuring python_select
--->  Building python_select
--->  Staging python_select into destroot
--->  Installing python_select @0.3_0
--->  Activating python_select @0.3_0
--->  Cleaning python_select

python27 インストールログ

$ sudo port install python27
--->  Computing dependencies for python27
--->  Fetching python27
--->  Attempting to fetch Python-2.7.tar.bz2 from http://distfiles.macports.org/python27
--->  Verifying checksum(s) for python27
--->  Extracting python27
--->  Applying patches to python27
--->  Configuring python27
--->  Building python27
--->  Staging python27 into destroot
--->  Installing python27 @2.7_1
--->  Activating python27 @2.7_1

To fully complete your installation and make python 2.7 the default,  please
run:
 	sudo port install python_select
 	sudo python_select python27

--->  Cleaning python27

投稿日:

ページのトップへ戻る