VSCode terminal problem $python3 app.py - zsh: command not found: app.py

Hello,
I was learning Python on Pycharm but I switched to VSCode for this course. Unfortunately, I can not use my VSCode Terminal. I installed Python 3.9 properly and then installed VSCode. I am able to use VSCode output window with code runner but I cannot use my terminal window so I can’t get any input since code runner lets read only.
I am on MacOS 10.15.7 Catalina.
Here is my problem:
$python3 app.py
zsh: command not found: app.py

image

1 Like

Did you type the “$”? It’s part of the standard prompt and nothing you type.

OMG, I have the same issue too. I am so confused.

1 Like

Don’t type the “$”!

It works! But why Mosh has the “$” when he didnt type it?

If I didnt type one, my terminal won’t have the “$” sign.

It’s part of the prompt. And it’s part of your prompt, too!
prompt

2 Likes

Awwwww! Now I got it! Thank you!

I just started the course, am brand new to programming. Have a PC and having same problem whether I use $ sign or not. Can someone pls help?

Looks like you haven’t installed Python yet or didn’t add it to your PATH.

Thank you for your help, Sam. It didn’t work for me I still get an error when I type python3 app.py whether I type $ sign or not; However, whatever I did, unfortunately I don’t really know what I did, my terminal window works when I run my program.

You are on Windows. The executable on windows is python, not python3.

You should never type a $ in front of an executable name.

So your problem is solved?

Hi Sam, I had installed python and ticked the path box. I reinstalled it but this time from the Microsoft store and this time its all working. Thanks for your help and responding. Frank

Please how can I add python to the path because I’m having the same problem

I’m on Mac.
For your question: Yes and No. My problem has solved for some cases like I can use my terminal and get input for most of the cases but I still get command not found error often when I go through videos.
Example:
zsh: command not found: pipenv

Follow the instructions I provide on this post:

If you are coding in mac, on the terminal type ‘python3’ (without the ‘’) and you should see the version you have installed. If no version appears, you have to uninstall Python3 and install but ADDING PYTHON TO THE PATH! it’s on the first screen of the installer.

Let me know how it goes.

Hi all - I have another problem when installing Python. I got it installed, I get the version type when I type “python3” however, when I run the code I get this message which I suppose should not be there. Can anyone please help?
Thank you.

It seems VS Code is trying to run using Python 2 (which is installed by default).

I posted some time ago a way to run programs. Check this post:

Let me know how it goes.
Nick

I’m sort of facing the same issue - I can run my Python code by clicking on Run followed by “Run Python file in Terminal”. However, I can’t run the code using “Run Code”. I tried changing the Python version in settings.json, but no luck. Does anyone have any advice? I’m attaching screenshots for anyone who sees this.

On windows, you can just say python app.py
Also try adding python to path when installing

On windows, you have to refer python as python in the terminal. All the run button is doing is it is openning a terminal, and typing in python and your file name and then hitting enter.

python “c:\users\Kaustubh Patil\Desktop\Pending\HelloWorld\app.py” ==> The file name