2023-12-16 10:47:45 +00:00
|
|
|
|
# python
|
|
|
|
|
|
|
|
|
|
> Python 语言解释器。
|
|
|
|
|
> 更多信息:<https://www.python.org>.
|
|
|
|
|
|
|
|
|
|
- 启动 REPL(交互式 shell):
|
|
|
|
|
|
|
|
|
|
`python`
|
|
|
|
|
|
|
|
|
|
- 执行特定 Python 文件:
|
|
|
|
|
|
|
|
|
|
`python {{路径/到/文件.py}}`
|
|
|
|
|
|
|
|
|
|
- 执行特定 Python 文件后进入 REPL:
|
|
|
|
|
|
|
|
|
|
`python -i {{路径/到/文件.py}}`
|
|
|
|
|
|
|
|
|
|
- 执行 Python 表达式:
|
|
|
|
|
|
|
|
|
|
`python -c "{{表达式}}"`
|
|
|
|
|
|
|
|
|
|
- 运行特定模块的脚本:
|
|
|
|
|
|
|
|
|
|
`python -m {{模块}} {{参数}}`
|
|
|
|
|
|
|
|
|
|
- 使用 `pip` 安装包:
|
|
|
|
|
|
|
|
|
|
`python -m pip install {{包}}`
|
|
|
|
|
|
|
|
|
|
- 互动调试 Python 脚本:
|
|
|
|
|
|
2023-12-21 07:26:25 +00:00
|
|
|
|
`python -m pdb {{路径/到/文件.py}}`
|
2023-12-16 10:47:45 +00:00
|
|
|
|
|
|
|
|
|
- 在当前目录中的端口 8000 上启动内置的 HTTP 服务器:
|
|
|
|
|
|
2023-12-21 07:26:25 +00:00
|
|
|
|
`python -m http.server`
|