Unable to run python files in terminal on Mac

Question:

I create a file and try run it in my terminal and get this error "/Library/Developer/CommandLineTools/usr/bin/python3: can’t open file ‘/Users/dcg/pb’: [Errno 2] No such file or directory"
I’m not sure why, as when I Cd and I’m in the correct directory. This is a my first time coding in python on this laptop. Any help appreciated. Thanks

I tried changing directories, creating new files, restarting pc. Nothing worked. I read online saying apparently its a problem with where python was downloaded.

Asked By: user20338595

||

Answers:

Are you sure to point to the python file you created ?
/Users/dcg/pb isn’t a python file, you may be missing the .py extension in your command line prompt.

Answered By: Gr1tch3
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.