Vscode 配置python调试环境

前言

与c++配置调试环境类似,利用vscode配置

Debug 配置

只需要配置launch.json中即可

cpp 复制代码
{
    // 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 Debugger: Current File with Arguments",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/xxx.py",
            "console": "integratedTerminal",
            "args": [],
            "env": {
                "CUDA_VISIBLE_DEVICES": "4",
                "DISPLAY": "xxx:xxx:0.0"
            }
        }
    ]
}
通过设置DISPLAY 可以借助Mobaxterm 进行转发
通过设置CUDA_VISIBLE_DEVICES可以

单元测试文件配置

unittest

setting.json中详细配置位置

cpp 复制代码
"python.testing.unittestArgs": [
    "-v",
    "-s",
    "./core/tests/",
    "-p",
    "test_*.py"
],

例如在本例中,将core/tests中所有的都读入

配置成功后即可找到,在此处运行即可

测试配置参考

https://blog.csdn.net/weixin_46074689/article/details/144992483

相关推荐
宁静致远20211 小时前
VSCode 开发 STM32 的 Keil工程 (Keil Assistant)
vscode·stm32·stm32cubeide
2601_962298272 小时前
Python自动化脚本的编写01
python·appium·自动化脚本·web自动化·应收账款管理
AIFQuant2 小时前
Python实时外汇行情接入实战:WebSocket与REST K线查询
开发语言·python·websocket
babe小鑫2 小时前
生物统计学专业校招:SAS、R、Python学习顺序实用指南
python·学习·r语言
vx_Biye_Design2 小时前
springboot游泳馆系统93765-计算机课程设计、毕业设计
java·javascript·spring boot·后端·python·spring·课程设计
晴天163 小时前
VSCodium 项目介绍
前端·javascript·vscode
固定资产管理系统软件3 小时前
该去哪里找专业靠谱的智慧智能设备固定资产管理系统?
人工智能·python
ctlover3 小时前
LangChain 概述
python·langchain
专业程序开发源3 小时前
springbootLivehouse票务系统-计算机课程设计、毕业设计
vue.js·spring boot·后端·python·django·课程设计·pygame
李高钢3 小时前
Python Django 框架入门:从零搭建你的第一个 Web 应用
前端·python·django