When I try to run Python code in Vs code this appears in the output I have already tried reinstalling both python and Vs code.Ive alos tried other solutions on stackoverflow and none have worked
1 Answer
If you already installed python on Windows, you need to add Python command in the PATH variable.
The complete path of python.exe can be added by:
- Right-click This PC and go to Properties
- Click on the Advanced system settings in the menu on the left.
- Click on the Environment Variables button on the bottom right.
- In the System variables section, select the Path variable and click on Edit.
The next screen will show all the directories that are currently a part of the PATH variable. Click on New and enter Python’s install directory. Now you can use python directly from the command prompt without having to write its full path location.
Try executing the command py --version; it will output the version of Python installed on your system.
4 Comments
Indices
but i want to use python in vs code not in the command prompt
codecracker
well, VS Code is a code editor, not a compiler...what it basically does is run your python file in a command prompt...install python, and add it to PATH as suggested above
Indices
how do add it to path?
codecracker
my answer explains how to do that
python. What message do you see?