👾
Tested on macOS Sonoma 14.0
If you already install Homebrew on your macOS, Python is already installed while installing Homebrew. You can check it by typing python3 --version in Terminal
sh
python3 --versionRunning Python Code in the Terminal
Python is an interpreted language, which means you can run your Python code directly in the terminal without needing to compile it first. Here’s how you can get started.
Write Your First Python Program
Just type python or python3 in the terminal and press Enter to open the Python interactive shell. In this shell, you can type Python commands directly and see the results immediately.
💡
to exit the interactive shell, type exit() or press Ctrl + D.