1

I can't run my code in Visual Studio Code. When I type $ code hello.py then this happens:

Enter image description here

2
  • 2
    Use python hello.py instead of code hello.py. Please consider checking my answer for more information Commented Jun 23, 2019 at 3:46
  • 1
    Welcome To StackOverFlow, Click on the tick next to your favorite answer to mark it as your answer. Commented Jun 23, 2019 at 3:51

2 Answers 2

2

In the image you have used code hello.py. You should instead use python hello.py. You can run on the command prompt only if you had "Add Python to Path" checked while installing the Python software.

If you are on a Mac

In Mac, Python 2.7 is automatically installed. If you want to use Python 3 then you have to manually install from the Python official website and use python3 hello.py to use Python 3.

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

Comments

-1

Always remember that a Python file will be run by using this command: python yourfile_name.py.

In your image you are trying to run your Python file with this command: code hello.py

Instead of using code hello.py, try to change it with python hello.py.

1 Comment

What does this answer add more to the answer posted 8 minutes before your answer?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.