Visual Studio Python "Failed to launch the Python Process, please validate the path 'python'' & Error: spawn python ENOENT

前端 未结 6 630
生来不讨喜
生来不讨喜 2021-01-19 09:26

I just downloaded Python and Visual Studio. I\'m trying to test the debugging feature for a simple \"Hello World\" script and I\'m receiving this error:

相关标签:
6条回答
  • 2021-01-19 09:34

    For those who are having this error after the recent (May-June of 2017) update of Visual Studio Code.

    Your old launch.json file might be causing this issue, due to the recent updates of launch.json file format and structure. Try to delete launch.json file in the .vscode folder. The .vscode folder exists in your workspace where your source code exists, not to be confused with the one in your user home folder (C:\Users\{username}\.vscode).

    This workaround worked fine for me with Windows10 + Visual Studio Code + Python extension. Just delete the existing launch.json and restart Visual Studio Code, and then start your debugging. The launch.json file might be regenerated again, but this time it should be in the correct shape.

    0 讨论(0)
  • 2021-01-19 09:34

    Simply restart your VB studio code. Those show that some packages have been downloaded but not yet installed until reboot it.

    0 讨论(0)
  • 2021-01-19 09:36

    Figured it out, if you just started python then you probably did not add python to your path.

    To do so uninstall python and then reinstall it. This time click "add python to path" at the bottom of the install screen.

    0 讨论(0)
  • 2021-01-19 09:45

    Add python path by following these steps. 1. Go to uninstall a program. 2. Go to Python 3.6.1 (this is my python version). Select and click on Uninstall/change. 3.Click on Modify. 4. Click next > In advanced options > tick add Python to environment variable. Click install. Restart VS code.

    0 讨论(0)
  • 2021-01-19 09:49

    This fixed it for me. The launch.json file in the .vscode folder in your working directory NOT in your program files directory needs to be opened in the Visual Studio Code editor. Here you need to find the line (for me line 13) at the top that says "pythonPath": here you type "py" and make sure to save it!! Ctrl+S. It has something to do I think with the way it looks for python spelled "python" when it needs to be spelled as "py".

    Here is the link where I found the info: https://paulpccodes.blogspot.com/2017/08/fixing-failed-to-launch-python-process.html

    0 讨论(0)
  • 2021-01-19 09:52

    Do not uninstall!

    1) Go to location that you installed the program. *example: C:\Program Files (x86)\Microsoft VS Code copy the location.

    2) right click on computer> properties >Advanced System Settings> Environment variables > under user variables find "path" click> edit> under variable value: go to the end of the line add ; then paste your location>ok > then go under system variables find "path"> do the same thing.... add ; then paste your location. FOR EXAMPLE" ;C:\Program Files (x86)\Microsoft VS Code

    3) Restart your Visual Studio Code

    0 讨论(0)
提交回复
热议问题