首页 > 编程语言 > 详细

VS Code 调试树莓派上的python程序

时间:2019-08-18 23:06:48      阅读:329      评论:0      收藏:0      [点我收藏+]

安装pip install ptvsd

在py文件前面加代码

import ptvsd
ptvsd.enable_attach()
ptvsd.wait_for_attach()
ptvsd.break_into_debugger()

调试配置文件launch.json代码

{
    // 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: 当前文件",
            "type":"python",
            "request":"launch",
            "program":"${file}",
            "console":"integratedTerminal",
            "env": {"PYTHONPATH":"${workspaceRoot}"},
            "pythonPath": "${config:python.pythonPath}"
        },
        {
            "name": "Python: 附加",
            "type": "python",
            "request": "attach",
            "port": 5678,
            "host": "192.168.1.23",
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "~"
                }
            ]
        }
    ]
}

 

VS Code 调试树莓派上的python程序

原文:https://www.cnblogs.com/qq812256/p/11373941.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!