【问题标题】:Setting the Python path in Visual Studio Code for file 'launch.json'在 Visual Studio Code 中为文件“launch.json”设置 Python 路径
【发布时间】:2018-06-09 03:28:18
【问题描述】:

我已经使用 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'

检查我的 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"
        ]
    }

有什么想法/建议吗?

【问题讨论】:

    标签: python configuration visual-studio-code vscode-settings pythonpath


    【解决方案1】:

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

    【讨论】:

    • "configurations": [ { "name": "Python", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "/Library/Frameworks/Python.framework/Versions/2.7/bin/python", "program": "${file}", "cwd": "/workspace/h5-automation/", "env": {}, "envFile": "${workspaceRoot}/.env", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ] },
    猜你喜欢
    • 2020-05-07
    • 1970-01-01
    • 2016-04-16
    • 1970-01-01
    • 2020-02-02
    • 2018-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多