Run a python script on mac terminal

Hello everyone, I just start to study python days ago.
Now I have installed python 3.11.3 and vscode on my macos 13.0.
And I think I have followed the instructions on vscode website using ‘homebrew’ to install python and make sure the location of my VScode installation is included in my PATH environment variable.
However,when I tried to run a python script from terminal, it just said it couldn’t find the file. I am totally confused. I blotted out my name and i have attached the pictures.


Sorry for my stupid question and I’ll appreciate it if you can help me with this.

this is the picture from my terminal

Looking at the 1st screen shot shows the path to your hello.py.
But that is not the path use from the terminal.

First is ~/Desktop/py4e/hello.py but you tried with ~/hello.py that does not exist.

Try

cd Desktop/py4e
python3 hello.py

Also please cut and paste text and use the pre-formatted text option, as i did above,
as pictures of text are hard to work with. (I could not cut-n-paste from your screen shots).

Thanks for your reply. It’s my first time using this forum and i will remember to use that option

cd: no such file or directory: Desktop/py4e
Hello world

I tried this and this is what i got from my terminal. Is this mean that i make it?

You need to find out what folder you are saving hello.py into.
Then cd to that folder before you run python3 hello.py.

You can try using find command to hunt for hello.py,
Beware macOS may pop up dialogs saying you need to let terminal access folders.

find . -name hello.py

Finally I made it. I used the following:

cd ~/Desktop/py4e
python3 hello.py

Thank you so much!