Select your Python interpreter by clicking on the status bar
Configure the debugger through the Debug Activity Bar
Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type in one of the following commands:
Command | Description |
---|---|
Python: Select Interpreter |
Switch between Python interpreters, versions, and environments. |
Python: Start REPL |
Start an interactive Python REPL using the selected interpreter in the IDE terminal. |
Python: Run Python File in Terminal |
Runs the active Python file in the IDE terminal. You can also run a Python file by right-clicking on the file and selecting Run Python File in Terminal . |
Python: Select Linter |
Switch from Pylint to Flake8 or other supported linters. |
Format Document |
Formats code using the provided formatter in the settings.json file. |
To see all available Python commands, open the Command Palette and type Python
.
Learn more about the rich features of the Python extension:
IntelliSense: Edit your code with auto-completion, code navigation, syntax checking and more
Linting: Get additional code analysis with Pylint, Flake8 and more
Code formatting: Format your code with black, autopep or yapf
Debugging: Debug your Python scripts, web apps, remote or multi-threaded processes
Environments: Automatically activate and switch between virtualenv, venv, pipenv, conda and pyenv environments
The extension is available in multiple languages: en
, zh-cn
通过单击状态栏选择Python解释器
通过Debug活动栏配置调试器
打开命令面板(macOS上是Command+Shift+P, Windows/Linux上是Ctrl+Shift+P),输入以下命令之一:
命令 | 描述 |
---|---|
Python: Select Interpreter |
在Python解释器、版本和环境之间切换。 |
Python: Start REPL |
在IDE终端中使用选定的解释器启动一个交互式Python REPL。 |
Python: Run Python File in Terminal |
在IDE终端中运行活动Python文件。您还可以通过右键单击该文件并选择在Run Python File in Terminal 来运行该文件。 |
Python: Select Linter |
从Pylint切换到Flake8或其他支持的lint。 |
Format Document |
使用settings.json 文件中提供的formatter格式化代码。 |
要查看所有可用的Python命令,请打开命令面板并键入Python 。 |
了解更多关于Python插件的丰富功能:
智能感知:编辑您的代码与自动完成,代码导航,语法检查以及更多
Linting:使用Pylint、Flake8等工具获得额外的代码分析
代码格式化:使用black、autopep或yapf格式化代码
调试:调试Python脚本、web应用程序、远程或多线程进程
环境:自动激活和切换virtualenv, venv, pipenv, conda和pyenv环境
插件支持多种语言:en
,zh-cn
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。