在 Visual Studio Code 中设置文件“launch.json”的 Python 路径

Lyl*_*man 9 python configuration pythonpath visual-studio-code

我使用 Visual Studio Code 已有几年了,我发现它是一个非常好的 IDE。我用 Python 编程的次数比任何其他语言都多。

令我困扰的是我没有抽出时间使用 IDE 的调试器(尽管它是一个功能)。

按调试播放按钮时出错:

Failed to launch the Python Process, please validate the path 'export PATH=$PATH:/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

检查我的 PYTHONPATH:

在此输入图像描述

我的launch.json文件:

"configurations": [
    {
        "name": "Python",
        "type": "python",
        "request": "launch",
        "stopOnEntry": true,
        "pythonPath": "${config:python.pythonPath}",
        "program": "${file}",
        "cwd": "/workspace/h5-automation/",
        "env": {},
        "envFile": "${workspaceRoot}/.env",
        "debugOptions": [
            "WaitOnAbnormalExit",
            "WaitOnNormalExit",
            "RedirectOutput"
        ]
    }
Run Code Online (Sandbox Code Playgroud)

有什么想法/建议吗?

rub*_*eet -7

如果您使用的是 *nix 系统,请启动终端并键入以获取 Python 路径,将其复制并粘贴为 launch.json 文件中which python的值。pythonPath