0
点赞
收藏
分享

微信扫一扫

vscode 下的 Python 配置

Separes 2021-10-04 阅读 77

参考:Getting Started with Python in VS Code

安装 vscode 的 Python 插件以及 Python 的环境本文不做叙述,仅仅介绍如何使用 vscode 编写和调试 Python。

在终端发起一个项目

mkdir hello
cd hello
code .  # vscode 打开当前目录

创建一个 .py 文件

在当前目录下创建一个空的 python 文件,比如:first.py

点击图1 中的选择 Python 的解释器,弹出类似下图的界面:

选择一个解释器之后,便可以在该环境下操作 Python 代码了。

vscode 支持 IntelliSense,比如:

点击运行按钮,便可以运行程序:

也可以使用 (Ctrl+Shift+P),调取 Python: Start REPL 来运行程序:

调试

我们可以在程序代码的最左端设置断点:

调用 F5 进行调试。

详细内容参考:Python debug configurations in Visual Studio CodePython testing in Visual Studio Code

举报

相关推荐

0 条评论