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

相关推荐
xcbrand1 小时前
快消品品牌策划公司哪家好
大数据·人工智能·python
2301_803875611 小时前
Python怎么计算NumPy数组的切比雪夫距离_使用abs与max求解
jvm·数据库·python
Dxy12393102161 小时前
Python使用XPath定位元素:动态计算与函数调用
开发语言·python
qq_349317481 小时前
CSS如何实现Bootstrap进度条自定义动画_利用keyframe关键帧
jvm·数据库·python
wltx16881 小时前
海外版GEO优化适合耳机出口吗?
人工智能·python
vonlycn1 小时前
PaddleDetection转ONNX 填坑
python·onnx·paddledetection
2401_871492851 小时前
Python机器学习怎么防止数据泄漏_确保Scaler在Pipeline内拟合
jvm·数据库·python
2301_818008442 小时前
MySQL怎样在触发器中引用新旧数据行_NEW与OLD关键字详解
jvm·数据库·python
L-影2 小时前
vscode安装SQLAlchemy步骤
ide·vscode·编辑器
毕胜客源码3 小时前
卷积神经网络的农作物识别系统(有技术文档)深度学习 图像识别 卷积神经网络 Django python 人工智能
人工智能·python·深度学习·cnn·django