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

相关推荐
想会飞的蒲公英9 分钟前
词袋模型与 CountVectorizer:文本也可以做特征表
人工智能·python·机器学习
LadenKiller11 分钟前
近期量化工具推荐,问题位置比功能清单更重要
人工智能·python
Hesionberger18 分钟前
LeetCode406:重建身高队列精髓解析
开发语言·数据结构·python·算法·leetcode
郭老二39 分钟前
【Python】基本语法:线程、锁
python
小白学大数据1 小时前
企业内网场景下 Python 自定义 CA 证书信任链的正确配置方法
开发语言·网络·python·信任链
Java面试题总结1 小时前
使用 Python 在 Excel 中添加和自定义文本框
开发语言·python·excel
浪客川1 小时前
idea 技巧 region 的使用
java·ide·intellij-idea
m沐沐1 小时前
【机器学习】基于 dlib 面部关键点的多表情分类
人工智能·python·深度学习·机器学习·计算机视觉·人脸识别·表情识别
热爱生活的五柒2 小时前
如何快速删除vscode项目下所有的http链接
ide·vscode·编辑器
️学习的小王2 小时前
Python + MySQL 学生信息管理系统实战教程
android·python·mysql