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

相关推荐
JJJJ_iii7 分钟前
【机器学习07】 激活函数精讲、Softmax多分类与优化器进阶
人工智能·笔记·python·算法·机器学习·分类·线性回归
PieroPc22 分钟前
用Python Streamlit sqlite3 写一个简单博客
数据库·python·sqlite
新子y44 分钟前
【小白笔记】关于 Python 类、初始化以及 PyTorch 数据处理的问题
pytorch·笔记·python
程序员小远1 小时前
如何编写自动化测试用例?
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·接口测试
Hello.Reader1 小时前
在 Flink 中用好 Java 8 Lambda类型推断、`.returns(...)` 与常见坑位
java·python·flink
滑水滑成滑头1 小时前
**发散创新:模拟计算的高级应用与实现**随着科技的飞速发展,模拟计算已经成为了众多领域的核心工
java·服务器·python·科技
程序猿John1 小时前
python深度学习之爬虫篇
开发语言·爬虫·python
少林and叔叔1 小时前
人工智能Pytorch开发环境的搭建
人工智能·pytorch·python·pycharm·conda
电棍2332 小时前
工程实践心得记录-pytorch要安装在哪里
人工智能·pytorch·python
星期天要睡觉2 小时前
深度学习——基于 PyTorch 的蔬菜图像分类
人工智能·pytorch·python·深度学习·分类