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

相关推荐
0思必得01 小时前
[Web自动化] 处理爬虫异常
运维·爬虫·python·selenium·自动化·web自动化
喵手1 小时前
Python爬虫零基础入门【第九章:实战项目教学·第17节】内容指纹去重:URL 变体/重复正文的识别!
爬虫·python·爬虫实战·python爬虫工程化实战·零基础python爬虫教学·内容指纹去重·url变体
喵手2 小时前
Python爬虫零基础入门【第五章:数据保存与入库·第1节】先学最通用:CSV/JSONL 保存(可复现、可分享)!
爬虫·python·python爬虫实战·python爬虫工程化实战·python爬虫零基础入门·数据保存与入库·csv/jsonl
子夜江寒2 小时前
OpenCV 学习:图像拼接与答题卡识别的实现
python·opencv·学习·计算机视觉
bjxiaxueliang2 小时前
一文掌握Python Flask:HTTP微服务开发从入门到部署
python·http·flask
SunnyRivers2 小时前
Python 中的 HTTP 客户端:Requests、HTTPX 与 AIOHTTP 对比
python·httpx·requests·aiohttp·区别
u0109272713 小时前
持续集成/持续部署(CI/CD) for Python
jvm·数据库·python
lixin5565563 小时前
基于迁移学习的图像风格增强器
java·人工智能·pytorch·python·深度学习·语言模型
阡陌..3 小时前
浅谈SAR图像处理---形态学滤波
图像处理·人工智能·python
qq_229058014 小时前
python-Dgango项目收集静态文件、构建前端、安装依赖
开发语言·python