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

相关推荐
CSDN_Colinw1 天前
Python GUI开发:Tkinter入门教程
jvm·数据库·python
chase。1 天前
Python包构建工具完全指南:python -m build 使用详解
开发语言·chrome·python
xin_yao_xin1 天前
PaddleOCR系列——《文本检测、文本识别》模型训练
人工智能·python·paddlepaddle·ppocr
2401_833197731 天前
用Python制作一个文字冒险游戏
jvm·数据库·python
今天也是爱大大的一天吖1 天前
vscode迁移插件至cursor的三个法子
ide·vscode·编辑器·cursor
万粉变现经纪人1 天前
如何解决 pip install cx_Oracle 报错 未找到 Oracle Instant Client 问题
数据库·python·mysql·oracle·pycharm·bug·pip
sw1213891 天前
使用Plotly创建交互式图表
jvm·数据库·python
2301_810160951 天前
如何为开源Python项目做贡献?
jvm·数据库·python
若惜1 天前
selenium自动化测试web自动化测试 框架封装Pom
前端·python·selenium
weixin_457760001 天前
基于pytorch实现LPR模型车牌识别
人工智能·pytorch·python·深度学习·lpr