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

相关推荐
卷无止境2 分钟前
Python 3.14 自由线程:拆掉 GIL 之后,我们到底得到了什么
后端·python
染指11104 分钟前
147.Agent-LangGraph归并函数
开发语言·人工智能·python·langchain·agents
小白学大数据21 分钟前
逆向分析短视频平台 a_bogus 参数:从 JavaScript 混淆到 Python 复现
javascript·python·音视频
外收内放33 分钟前
数据分析(数据清洗)
python·学习·数据分析
小小张说故事1 小时前
Python 的 True + True 为什么等于 2?bool 是 int 子类,这个设计坑了多少人
python
神仙别闹1 小时前
基于Python实现自动化测试作业—图像增广方案
图像处理·python·计算机视觉
坊钰1 小时前
【LangGraph框架入门级】12. 人机交互:interrupt 中断与 Command 恢复
开发语言·数据库·python·人机交互·ai编程·langgraph
把我格子衫拿来1 小时前
四元数为什么突然变号?旋转表示、SLERP 与位姿插值避坑
python·机器人·坐标变换·四元数·slerp
Chasing__Dreams2 小时前
python杂识--24--Nuitak打包exe
开发语言·python
把我格子衫拿来2 小时前
RANSAC 粗配准:离群点很多时,怎样为 ICP 找到可信初值?
python·计算机视觉·三维重建·ransac·点云配准