Linux command
ipython 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Start IPython
ipython
Run script
ipython [script.py]
Start with specific profile
ipython --profile=[name]
Run code and enter interactive shell
ipython -i -c "[import numpy as np; arr = np.array([1,2,3])]"
Start with no startup banner
ipython --no-banner
Create a named profile
ipython profile create [name]
Start the debugger on exceptions
ipython --pdb
说明
ipython (Interactive Python) is an enhanced Python shell that extends the standard interpreter with features designed for productive exploratory programming. It provides automatic syntax highlighting, comprehensive tab completion for objects, modules, and file paths, inline docstring access with `?` and `??` suffixes, and a searchable input history that persists across sessions. A distinguishing feature is IPython's system of magic commands -- special directives prefixed with `%` (line magics) or `%%` (cell magics) -- that provide functionality outside of normal Python syntax, such as `%timeit` for benchmarking, `%run` for executing scripts, `%debug` for post-mortem debugging, and `%paste` for correctly handling indented code from the clipboard. IPython also integrates tightly with the scientific Python ecosystem, offering optional auto-import of NumPy and Matplotlib via `--pylab`, and serves as the default kernel for Jupyter notebooks.
参数
- -i
- Inspect interactively after script.
- -c _code_
- Execute code.
- --profile _name_
- Use named profile.
- --colors _scheme_
- Color scheme.
- --no-banner
- Suppress startup banner.
- --automagic
- Enable calling magic commands without the % prefix.
- --pdb
- Start debugger on exception.
- --pylab _backend_
- Load numpy and matplotlib.
- --matplotlib _backend_
- Load matplotlib.
FAQ
What is the ipython command used for?
ipython (Interactive Python) is an enhanced Python shell that extends the standard interpreter with features designed for productive exploratory programming. It provides automatic syntax highlighting, comprehensive tab completion for objects, modules, and file paths, inline docstring access with `?` and `??` suffixes, and a searchable input history that persists across sessions. A distinguishing feature is IPython's system of magic commands -- special directives prefixed with `%` (line magics) or `%%` (cell magics) -- that provide functionality outside of normal Python syntax, such as `%timeit` for benchmarking, `%run` for executing scripts, `%debug` for post-mortem debugging, and `%paste` for correctly handling indented code from the clipboard. IPython also integrates tightly with the scientific Python ecosystem, offering optional auto-import of NumPy and Matplotlib via `--pylab`, and serves as the default kernel for Jupyter notebooks.
How do I run a basic ipython example?
Run `ipython` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -i do in ipython?
Inspect interactively after script.