Linux command
ptpython 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start Python REPL
ptpython
Start with vi mode
ptpython --vi
Execute file then REPL
ptpython -i [script.py]
Start IPython mode
ptipython
说明
ptpython is an enhanced Python REPL built on the prompt_toolkit library. It provides syntax highlighting, multi-line editing, autocompletion, mouse support, and vi/emacs key bindings, offering a significantly improved interactive experience over the default Python shell. Features include function signature display, input validation, clipboard support, and the ability to embed ptpython in existing applications. The ptipython variant combines ptpython's UI with IPython's magic commands and features.
参数
- --vi
- Use Vi-style key bindings instead of Emacs (default).
- -i, --interactive
- Drop into the REPL after running the given script.
- --light-bg
- Optimize colors for terminals with a light background.
- --dark-bg
- Optimize colors for terminals with a dark background.
- --config-file _FILE_
- Use the specified Python configuration file instead of the default.
- --history-file _FILE_
- Use a custom history file location.
- -V, --version
- Display version information.
FAQ
What is the ptpython command used for?
ptpython is an enhanced Python REPL built on the prompt_toolkit library. It provides syntax highlighting, multi-line editing, autocompletion, mouse support, and vi/emacs key bindings, offering a significantly improved interactive experience over the default Python shell. Features include function signature display, input validation, clipboard support, and the ability to embed ptpython in existing applications. The ptipython variant combines ptpython's UI with IPython's magic commands and features.
How do I run a basic ptpython example?
Run `ptpython` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --vi do in ptpython?
Use Vi-style key bindings instead of Emacs (default).