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

相关推荐
m0_377618236 分钟前
c++如何将双精度浮点数以科学计数法写入文件_scientific标志【详解】
jvm·数据库·python
weixin_424999369 分钟前
如何检测SQL注入风险_利用模糊测试技术发现漏洞
jvm·数据库·python
2301_7751481512 分钟前
如何用正则具名捕获组 (-) 提升复杂数据的提取效率
jvm·数据库·python
2501_9142459317 分钟前
Go语言如何在VSCode中开发_Go语言VSCode配置教程【避坑】.txt
jvm·数据库·python
2301_7826591820 分钟前
MongoDB如果有一个分片完全宕机集群还能用吗_受影响数据的不可读与分片隔离感知
jvm·数据库·python
justjinji21 分钟前
JavaScript中严格模式use-strict对引擎解析的辅助
jvm·数据库·python
Absurd58723 分钟前
CSS如何使用-default获取默认选项样式_通过状态伪类突出预选表单项
jvm·数据库·python
Predestination王瀞潞24 分钟前
Java EE3-我独自整合(第七章:Spring AOP 通知类型)
python·spring·java-ee
weixin_4585801231 分钟前
CSS如何让flex布局支持老版本浏览器_添加-webkit-前缀与兼容性写法
jvm·数据库·python
Shorasul35 分钟前
CSS viewport单位在旧移动端支持不佳_利用固定像素值与rem配合
jvm·数据库·python