-1

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

12
  • 1
    Is python in PATH? Commented Jul 13, 2022 at 16:33
  • Please explain what you have tried already, so we don't have to go through the same debugging steps that have already failed for you. Commented Jul 13, 2022 at 16:35
  • Open Command Prompt and type python. What message do you see? Commented Jul 13, 2022 at 16:35
  • Why would you expect reinstalling java to make python work? Sounds like you need to install python. Commented Jul 13, 2022 at 16:35
  • 1
    Does this answer your question? How to add to the PYTHONPATH in Windows, so it finds my modules/packages? Commented Jul 13, 2022 at 17:26

1 Answer 1

0

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 o​n 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.

Sign up to request clarification or add additional context in comments.

4 Comments

but i want to use python in vs code not in the command prompt
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
how do add it to path?
my answer explains how to do that

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.