확장 Code Runner를 사용하여 VS Code에서 Python 스크립트를 실행하는 방법은 무엇입니까?

확장 Code Runner를 사용하여 VS Code에서 Python 스크립트를 실행하는 방법은 무엇입니까?

VS Code에 Code Runner 확장을 설치했습니다. 내에서는 옵션을 settings.json설정했고 "python.pythonPath": "python"Python은 내 Win10 PATH 변수에 있습니다.

settings.json의 옵션 에서 code-runner.executorMapPython은 "python": "python.pythonPath". 그러나 Ctrl+ Alt+ 로 스크립트를 실행하면 다음과 같은 N결과가 나타납니다.

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

공백에 대해 불평하는 code-runner.executorMap것처럼 Python 옵션을 절대 경로로 설정하면"C:\\Program Files (x86)\\Python36-32\\python.exe"

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

첫 번째 공백이 나타날 때까지 첫 번째 단어만 사용됩니다. \공백을 이스케이프 처리 하면 JSON 오류가 발생합니다.

답변1

나는 그것을하는 방법을 찾았습니다. "code-runner.executorMap"Python 옵션 아래 의 settings.json에서 간단 합니다.

"python": "python"

이제 Win10 PATH에서 Python을 검색하고 실행 아이콘이나 ctrl-alt-N을 클릭하여 실행됩니다.

관련 정보