1.1 Resources
1.2 Installing Python
The best way to install Python is with Homebrew.
You can install multiple versions of Python and they won't conflict with each other.
brew install python
installs Python 2
brew install python3
installs Python 2
1.3 Running Python
to run Python 2
python
to run Python 3
python3
To run IDLE for Python 2
idle
To run IDLE for Python 3
idle3
1.4 Quick Check
@ terminal
python
now your in Python command line mode, try some math:
>>> 2+2 4
and
>>> print "Hello World" Hello World
and
>>> exit() ✔ ~ 16:59 $
also try...
Create a file called test.py
@ test.py
def main(): print("It's a Function!") if __name__ == "__main__": main()
Open your terminal in the same folder and run
python test.py
That should execute the program in Python2
python3 test.py
That should execute the program in Python3
You are ready to go!