簡體   English   中英

在 Visual Studio Code 中為文件“launch.json”設置 Python 路徑

[英]Setting the Python path in Visual Studio Code for file 'launch.json'

我已經使用 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"
        ]
    }

任何想法/建議?

如果您使用的是 *nix 系統,請啟動終端並輸入which python以獲取 Python 路徑,將其復制並粘貼為 launch.json 文件中pythonPath的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM