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

相关推荐
白帽小阳20 分钟前
Typora插件开发指南:打造专属IDE式写作环境
c语言·网络·python·网络安全·github·pygame·护网行动
等什么秋23 分钟前
idea2024下载
java·ide·intellij-idea
满怀冰雪26 分钟前
02-安装 PaddlePaddle:CPU、GPU 与环境检查入门
人工智能·python·paddlepaddle
独隅37 分钟前
Typora插件开发终极指南:从底层逆向到专属IDE式写作环境
ide
hanxiuchao38 分钟前
告别客户端臃肿!网页端 M3U8 播放调试方案,适配全办公场景
运维·python·django·m3u8·m3u8播放
3DVisionary43 分钟前
如何用单目高速DIC把“看不见“的振动变成“数得清“的数据
java·spring boot·python·数码相机·微小振动·精密件·单目高速dic
FriendshipT1 小时前
Ultralytics:解读BNContrastiveHead模块
人工智能·pytorch·python·深度学习·目标检测
tkevinjd1 小时前
416分割等和子集
java·python·算法·leetcode·职场和发展
大学生技术野农1 小时前
基于Yolo26和Grad-CAM可视化融合的深度学习的猕猴桃分级系统-Python源码
python·深度学习·yolo
布朗克1681 小时前
Go 入门到精通-15-错误处理
开发语言·python·golang·错误处理