pythonにipythonへのエイリアスを設置してもいいが、複数の環境で使うにはipythonが存在するかをチェックして、あればipythonを使い、なければそのままのシェルを使うようにする方がいい。
方法
pythonインタプリタは起動されるとPYTHONSTARTUPで指定されたファイルを実行する。その中でipythonを起動するだけ。
.zshrc
export PYTHONSTARTUP=$HOME/.pythonrc
.pythonrc
try:
from IPython.frontend.terminal.ipapp import launch_new_instance
launch_new_instance()
raise SystemExit
except ImportError:
# ipythonがインストールされていない場合
pass
実行するとこんな感じになる
$ python
Python 2.7.2 (default, Feb 16 2012, 15:37:03)
[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.
Python 2.7.2 (default, Feb 16 2012, 15:37:03)
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: