r/learnpython • • 4h ago

About running python code in terminal

Guys, I am beginner. I have the python code and have saved in file. Now I want to place the file path in the terminal and run that code. I don't know what should I write before adding the file path? Please help!

4 Upvotes

16 comments sorted by

View all comments

1

u/EszterSantos72 4h ago

Type python3 before your file path, like python3 myscript.py. On some systems just python works, but if you have both Python 2 and 3 installed, python3 makes sure you run the right version.

1

u/South-Put-7948 3h ago

Thank you so much it worked.