Make the default interactive shell IPython

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. ..

Method

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

Make the default interactive shell IPython
Make the default value of the argument immutable
the shell review
Make the tool simply
Make the default value of the argument immutable (article explanation)
I checked the default OS and shell of docker-machine
Make slides with iPython
[Shell] How to get the remote default branch in Git
Make iPython available on OSGeo4W
Launch the IPython notebook server
Until the shell finds the command