How do I run a file in Python? Need help with the command! or What’s the easiest way to use Python to

16 Replies, 1367 Views

For Mac users, sometimes the default `python` points to Python 2 (which is outdated).

Always use `python3 myscript.py` to be safe.

Also, if you’re tired of typing the full path, check out `alias` in bash to make a shortcut!

---

Oh wow, thanks everyone! Didn’t expect so many helpful replies.

I tried `python3 myscript.py` on my Mac and it worked perfectly. Also, the `input()` trick saved me from the flashing window issue.

One more thing—if I want to pass arguments when I python run a file, how does that work? Like `python script.py arg1 arg2`?

Thanks again! You guys rock.

Messages In This Thread



Users browsing this thread: 1 Guest(s)