The IDLE that comes with Python for Mac only gives you an interactive REPL (ie You type a line of Python and it executes it as soon as you hit Enter.). In order to run files, this is what you have to do.
- Download Python 3.x from https://www.python.org/downloads/ and run the pkg file
- Make a desktop shortcut to Python Launcher
- Open up TextEdit and choose Format, Make Text Only
- Write your Python program, e.g. print (“Hello World!”)
- Save as HelloWorld.py
- Find HelloWorld.py in a Finder window and drag it onto your new Python Launcher desktop shortcut
- Bob’s your uncle
Alternatively you can find a full IDE. My understanding is that PyCharm is pretty good.