Отладка Python в коде VS не работает - PullRequest
0 голосов
/ 05 мая 2018

Я пытаюсь отладить мой скрипт на Python в VS Code, но отладчик даже не запускается. Синяя полоса продолжает загружаться после нажатия зеленой кнопки воспроизведения, а полоса ниже, которая должна была стать оранжевой, не меняется и становится синей, как есть.

Что я пробовал? 1. Добавление пути в файл launch.json. Вот мой файл 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: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}"
    },
    {
        "name": "Python: Attach",
        "type": "python",
        "request": "attach",
        "localRoot": "${workspaceFolder}",
        "remoteRoot": "${workspaceFolder}",
        "port": 3000,
        "secret": "my_secret",
        "host": "localhost"
    },
    {
        "name": "Python: Terminal (integrated)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "pythonPath": "${config:python.pythonPath}"
    },
    {
        "name": "Python: Terminal (external)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "externalTerminal",
        "pythonPath": "${config:python.pythonPath}"
    },

Я правильно настроил путь в расширенных настройках Windows, а также в настройках рабочей области кода VS.

{
"python.pythonPath": "C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe",
"code-runner.runInTerminal": true
}

Если я пытаюсь запустить отладку в Python: текущий файл или Python: Terminal (Integrated) , я получаю это сообщение об ошибке:

C:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser>cd c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe C:\Users\Admin\.vscode\extensions\ms-python.python-2018.4.0\pythonFiles\PythonTools\visualstudio_py_launcher.py c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser 49947 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser\test.py "

'cmd' is not recognized as an internal or external command,operable program or batch file.

И когда я пытаюсь запустить его в Python: Terminal (external) , IDE находится в состоянии IDLE.

Любая помощь высоко ценится.

1 Ответ

0 голосов
/ 05 мая 2018

Я понял это.

Мне просто нужно было добавить путь «C: \ Windows \ System32» в переменной пути в переменных среды в разделе «Дополнительные параметры системы».

...