Python Tutorial for Beginners 1: Install and Setup for Mac and Windows
Based on Corey Schafer's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Install Python 3.6 from python.org rather than relying on a preinstalled Python 2.7 on macOS.
Briefing
Getting Python running on your computer is the whole point of this beginner setup walkthrough—and it’s handled separately for Mac and Windows, then unified into the same “write code, run code” workflow. On macOS, Python 2.7 often comes preinstalled, so the key step is installing Python 3 from python.org and making sure the terminal’s `python` command points to Python 3 (via a shell alias). On Windows, the essential move is installing Python 3.6 and selecting the installer option to “add Python to PATH,” so the `python` command works immediately in Command Prompt.
After installation, the tutorial shifts from setup to first contact with Python itself. Typing `python` in a terminal or Command Prompt opens an interactive prompt where code runs one line at a time. A simple `print('Hello World')` demonstrates output, and assigning a variable like `x = 10` followed by `print(x)` shows that values can be stored and retrieved interactively. The interactive mode is positioned as useful for quick tests, not for building real programs.
To write a multi-line program, the tutorial uses a plain text editor and demonstrates Python file creation with IDLE—the editor that ships with Python. In IDLE, creating a new file, writing `print('Hello World')`, and saving it as something like `intro.py` sets up a script that can be run from the command line by calling `python intro.py` (from the directory where the file lives). A short detour shows how inline comments work: lines starting with `#` are ignored by Python at runtime, serving only as notes for humans reading the code.
From there, the workflow expands beyond IDLE. The tutorial notes that beginners can stick with IDLE and run scripts from the command line, but for heavier use it recommends upgrading to a more capable editor or IDE. Examples include Sublime Text and Atom as text editors with extra functionality, and JetBrains PyCharm as a full IDE with features like debugging. The tutorial also demonstrates that Sublime Text can run the same `intro.py` file directly through its build/run commands.
The practical takeaway is a complete path from “Python not ready” to “Hello World runs reliably”: install the correct Python 3 version, ensure the command-line entry point works (`python` maps to Python 3 on macOS; PATH is set on Windows), then choose whether to code in IDLE or a preferred editor and run scripts from the terminal. The next step promised is fundamentals—starting with variables and the string data type.
Cornell Notes
This setup guide walks through installing Python 3.6 on both macOS and Windows, then using it to run code in two ways: an interactive prompt and a saved script file. On macOS, Python 2.7 may be preinstalled, so Python 3.6 is installed from python.org and a bash alias is used so the `python` command runs Python 3. On Windows, Python 3.6 is installed and the installer option to add Python to PATH is selected so Command Prompt recognizes `python`. After installation, `python` opens an interactive REPL for one-line tests, while IDLE (or another editor like Sublime Text) is used to create multi-line `.py` files such as `intro.py` that run via `python intro.py`. Comments starting with `#` are ignored at runtime.
Why does macOS often show Python 2.7 first, and how does the setup fix that?
What’s the difference between the interactive prompt and running a script file?
How does the guide ensure Windows can run `python` from Command Prompt?
Where does IDLE fit into the beginner workflow?
What happens to comments in Python scripts?
Why might a beginner switch from IDLE to another editor like Sublime Text or PyCharm?
Review Questions
- What steps on macOS ensure that typing `python` runs Python 3.6 instead of Python 2.7?
- When would you choose the interactive prompt over creating a `.py` file?
- How does selecting “add Python to PATH” change what happens when you type `python` in Windows Command Prompt?
Key Points
- 1
Install Python 3.6 from python.org rather than relying on a preinstalled Python 2.7 on macOS.
- 2
On macOS, verify versions with `python --version` and `python3 --version`, then use a bash alias so `python` maps to Python 3 if needed.
- 3
On Windows, select the installer option to add Python to PATH so Command Prompt recognizes the `python` command.
- 4
Use the interactive prompt for quick one-line tests, but create `.py` files for multi-line programs.
- 5
Create and run scripts by saving a file like `intro.py` and executing it with `python intro.py` from the correct directory.
- 6
Use `#` for comments; they are ignored at runtime and won’t affect program output.
- 7
Consider upgrading from IDLE to editors/IDEs like Sublime Text, Atom, or PyCharm for more features such as debugging.