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

相关推荐
薛定猫AI几秒前
【技术干货】大模型文档结构化提取实战:Python解析PDF发票并批量生成CSV
java·python·pdf
zhiSiBuYu05177 分钟前
RAG 性能优化与缓存策略实战指南
人工智能·python·机器学习
荣码16 分钟前
Prompt工程实战:同一个需求换3种写法,效果差10倍
java·python
想会飞的蒲公英17 分钟前
集成学习入门:Bagging、Boosting 到底在组合什么
人工智能·python·机器学习·集成学习·boosting
努力努力再努力搬砖18 分钟前
批量下载ERA5数据
python
_老码21 分钟前
AI-reader阅读助手开发过程
人工智能·python·ai
_Jimmy_25 分钟前
python性能分析工具
python
小猴子爱上树1 小时前
Temu批量视频翻译Python实现方案
开发语言·python·音视频
X1A0RAN1 小时前
Python 并发请求性能优化实战
python·性能优化·并发编程
陈同学xxx1 小时前
Hermes Agent 接入飞书,在手机上随时聊天
linux·python·飞书