vscode ~ launch.json配置python

本文详细介绍了如何在Visual Studio Code(VSCode)中配置Python和C/C++的开发环境,包括设置Python解释器路径、环境变量及调试选项,以及C/C++的环境配置步骤,助你高效进行代码开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置文件内容

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Python",
          "type": "python",
          "request": "launch",
          "stopOnEntry": false,
          "pythonPath": "C:\\Users\\hetao\\anaconda3\\python.exe",
          "program": "${file}",
          "cwd": "${workspaceRoot}",
          "env": {},
          "envFile": "${workspaceRoot}/.env",
          "debugOptions": [
              "WaitOnAbnormalExit",
              "WaitOnNormalExit",
              "RedirectOutput"
          ]
      }
  ]
}

查看python解释器路径

import sys
import os

print('当前 Python 解释器路径:')
print(sys.executable)
r"""
当前 Python 解释器路径:
C:\Users\jpch89\AppData\Local\Programs\Python\Python36\python.EXE
"""

print()
print('当前 Python 解释器目录:')
print(os.path.dirname(sys.executable))
r"""
当前 Python 解释器目录:
C:\Users\jpch89\AppData\Local\Programs\Python\Python36
"""



CVisual Studio Code (vscode) 配置 C / C++ 环境 - 步平凡 - 博客园

Visual Studio Code (vscode) 配置 C / C++ 环境 - 步平凡 - 博客园

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值