You can set an alias for ipython in python, but if you want to use it in multiple environments, it is better to check if ipython exists, use ipython if it exists, and use the shell as it is if not. ..
When the python interpreter is started, it executes the file specified by PYTHONSTARTUP. Just start ipython in it.
.zshrc
export PYTHONSTARTUP=$HOME/.pythonrc
.pythonrc
try:
from IPython.frontend.terminal.ipapp import launch_new_instance
launch_new_instance()
raise SystemExit
except ImportError:
#If ipython is not installed
pass
When you run it, it looks like this
$ 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]:
Recommended Posts