在 vscode 中找不到 python 调试适配器 - WSL:Ubuntu [英] python debug adapter not being found in vscode - WSL:Ubuntu

查看:156
本文介绍了在 vscode 中找不到 python 调试适配器 - WSL:Ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

  • 在 VSCode 的调试选项卡中,您不必编辑任何配置,除非您需要定义解释器的位置.就我而言,我将位置定义为我的虚拟环境的 bin/目录.

  • 祝你好运!

    I'm trying to debug a python script in vscode using the Remote WSL extension with Python 3.9.1.

    When I start debugging mode(F5), the below message is immediately shown:

    Couldn't find a debug adapter descriptor for debug type 'python' (extension might have failed to active)

    The message offers me to Open launch.json, I still don't know what I have to change in my json file, below are my current settings:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python: Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal",
                "env": {
                    "PYTHONPATH": "c:/<my_user_name>/projects",
                },
            }
        ]
    }
    

    What I have tried until now:

    • Re-installed Python extension and read the doc. However the doc does not help to solve the issue at all. These steps has been already suggest in another post here almost 3 years ago.
    • Reload vscode in order to reload the extensions, as the error shows an extensions might have failed to active. No success.

    解决方案

    If you have VSCode, installed already before you could configure WSL, you could be facing this issue. Here's how I resolved it:

    1. To the bottom left corner of VSCode, you may find the environment choice. Natively, this corresponds to windows, you might have to switch this to Remote-WSL: New Window which will open VSCode in a new window.

    2. In the debug tab of VSCode, you don't have to edit any configuration, except you need to define the location of your interpreter. In my case, I defined the location to be as my virtual environments' bin/ directory.

    Good Luck!

    这篇关于在 vscode 中找不到 python 调试适配器 - WSL:Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆