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

相关推荐
亚林瓜子13 小时前
AWS Glue Python Shell任务中读取Athena数据库
数据库·python·shell·aws·glue·athena
zhangchaoxies13 小时前
Golang怎么用K8s Secret管理密钥_Golang如何从K8s Secret安全读取密码和证书【操作】
jvm·数据库·python
2402_8548083713 小时前
JavaScript中模块化在游戏引擎开发中的资源调度作用
jvm·数据库·python
生信研究猿13 小时前
第2题-模型推理量化加速优化问题
python·算法
看海的四叔13 小时前
【Python】阿里云 DataWorks + ODPS + 钉钉联动实战:配合[特殊字符]全搞定
python·阿里云·api·odps·requests·openclaw
2401_8654396315 小时前
HTML函数在低温环境下启动慢吗_温度对硬件启动影响【方法】
jvm·数据库·python
m0_3776182321 小时前
Golang怎么连接MySQL数据库_Golang MySQL连接教程【总结】
jvm·数据库·python
LN花开富贵1 天前
【ROS】鱼香ROS2学习笔记一
linux·笔记·python·学习·嵌入式·ros·agv
weixin_586061461 天前
C#怎么通过反射获取类属性_C#如何动态读取元数据【进阶】
jvm·数据库·python
Jurio.1 天前
本机开发 + 多机执行的极简远端运行工具
linux·git·python·github·远程工作