以前の記事、図書紹介#004:「Go言語プログラミング入門 on Google App Engine」を見ていると、Lionには複数のヴァージョンのPythonがプリンストールされている様です。
ネット上で検索するも、意外と情報がありません。常道として「man python」を眺めていると、まずプリインストールされているのは;
で、実際にGAEに対応させる場合、ディフォールトでpython2.5.6をコールしたいわけである。そこで実際のコマンドを調べてみた;
だから、少なくとも
という論議の最後で、Alexさんが「Apr 22 '11」のコメントで;
ーーーー このポストの履歴
ネット上で検索するも、意外と情報がありません。常道として「man python」を眺めていると、まずプリインストールされているのは;
- Python 2.5
- Python 2.6
- Python 2.7
div-mm:~ u1$ python Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**10 1024 >>> exit() div-mm:~ u1$ python2.5 Python 2.5.6 (r256:88840, Jul 31 2011, 19:30:45) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**5 32 >>> ^D div-mm:~ u1$ python2.6 Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**6+0.7 64.700000000000003 >>> ^D div-mm:~ u1$ python2.7 Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**7 128 >>> ^D div-mm:~ u1$少なくとも、ヴァージョン番号をつければ、該当するインタプリタが呼び出される様です。その他の方法でも出来るらしい;
div-mm:~ u1$ defaults write com.apple.versioner.python Version 2.5 div-mm:~ u1$ python Python 2.5.6 (r256:88840, Jul 31 2011, 19:30:45) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**5+.6 32.600000000000001 >>> ^D div-mm:~ u1$ python Python 2.5.6 (r256:88840, Jul 31 2011, 19:30:45) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**5+.06 32.060000000000002 >>> ^D div-mm:~ u1$ defaults write com.apple.versioner.python Version 2.6 div-mm:~ u1$ python Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**6+.007 64.007000000000005 >>> ^D div-mm:~ u1$ defaults write com.apple.versioner.python Version 2.7 div-mm:~ u1$ python Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**7+.0001 128.0001 >>> ^D div-mm:~ u1$ echo "-----------------------------" ----------------------------- div-mm:~ u1$ export VERSIONER_PYTHON_VERSION=2.5 div-mm:~ u1$ python Python 2.5.6 (r256:88840, Jul 31 2011, 19:30:45) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 2**5+0.6 32.600000000000001 >>> ^D div-mm:~ u1$
で、実際にGAEに対応させる場合、ディフォールトでpython2.5.6をコールしたいわけである。そこで実際のコマンドを調べてみた;
div-mm:~ u1$ div-mm:~ u1$ which python /usr/bin/python div-mm:~ u1$ ll /usr/bin/py* -rwxr-xr-x 6 root wheel 925 9 18 15:47 /usr/bin/pydoc* lrwxr-xr-x 1 root wheel 74 9 18 15:47 /usr/bin/pydoc2.5@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pydoc2.5 lrwxr-xr-x 1 root wheel 74 9 18 15:47 /usr/bin/pydoc2.6@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pydoc2.6 lrwxr-xr-x 1 root wheel 74 9 18 15:47 /usr/bin/pydoc2.7@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7 -rwxr-xr-x 2 root wheel 62752 9 18 15:47 /usr/bin/python* -rwxr-xr-x 6 root wheel 925 9 18 15:47 /usr/bin/python-config* lrwxr-xr-x 1 root wheel 75 9 18 15:47 /usr/bin/python2.5@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 lrwxr-xr-x 1 root wheel 82 9 18 15:47 /usr/bin/python2.5-config@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config lrwxr-xr-x 1 root wheel 75 9 18 15:47 /usr/bin/python2.6@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 lrwxr-xr-x 1 root wheel 82 9 18 15:47 /usr/bin/python2.6-config@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config lrwxr-xr-x 1 root wheel 75 9 18 15:47 /usr/bin/python2.7@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 lrwxr-xr-x 1 root wheel 82 9 18 15:47 /usr/bin/python2.7-config@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config -rwxr-xr-x 2 root wheel 62752 9 18 15:47 /usr/bin/pythonw* lrwxr-xr-x 1 root wheel 76 9 18 15:47 /usr/bin/pythonw2.5@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 lrwxr-xr-x 1 root wheel 76 9 18 15:47 /usr/bin/pythonw2.6@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6 lrwxr-xr-x 1 root wheel 76 9 18 15:47 /usr/bin/pythonw2.7@ -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7 div-mm:~ u1$ ll /System/Library/Frameworks/Python.framework/Versions/ total 8 drwxr-xr-x 7 root wheel 238 9 18 15:48 2.3/ drwxr-xr-x 11 root wheel 374 10 13 10:55 2.5/ drwxr-xr-x 11 root wheel 374 10 13 10:55 2.6/ drwxr-xr-x 11 root wheel 374 10 1 11:57 2.7/ lrwxr-xr-x 1 root wheel 3 9 18 15:47 Current@ -> 2.7 div-mm:~ u1$
だから、少なくとも
- /System/Library/Frameworks/Python.framework/Versions/Current@ -> 2.5
という論議の最後で、Alexさんが「Apr 22 '11」のコメントで;
と指摘されている。cd /Library/Frameworks/Python.framework/Versions sudo rm Current sudo ln -s /Library/Frameworks/Python.framework/Versions/3.0 Current
ーーーー このポストの履歴
- 開始 2012-01-23 (月) 20:36
- 追加 2012-01-25 (水) 13:19 Alexさんが「Apr 22 '11」のコメント
0 件のコメント:
コメントを投稿