Installing Python
Why this matters: Python's reputation for being beginner-friendly stops at the install. "Add Python to PATH" is the single most common point where new students give up. Spend 15 to 20 careful minutes here and you are set for years.
Pick the right tool for your situation
Python itself is just the language. To write Python you need a place to type the code. There are three sensible options.
| If this sounds like you... | Use this | Why |
|---|---|---|
| You want a popular, general-purpose editor that works for many languages | VS Code + Python extension | The most-used editor in the industry. Free. Excellent Python support via Microsoft's official extension. |
| You want an editor laser-focused on Python | PyCharm Community Edition | Powerful debugger and refactoring built in. Some students prefer how much it "knows" about Python out of the box. |
| You just want to type a few lines and see what happens | The Python shell (REPL) | Built into Python. No setup required. Great for the first few lessons of this course. We use it in Lesson 3. |
You only need an internet connection during installation. Once Python and your editor are installed, you can write, run and debug locally with no connection.
Install Python
Windows
- Visit https://python.org/downloads
- Download the latest Python 3 release (3.11 or later)
- Run the installer
- Critical: check the box that says "Add python.exe to PATH" at the bottom of the first installer screen. This is the single most common mistake new students make.
- Click "Install Now"
- When it finishes, click "Close"
macOS
The easiest path on Mac is Homebrew:
brew install python
If you do not have Homebrew, install it first from https://brew.sh.
Linux
Most Linux distributions ship Python already. Verify with:
python3 --version
If it is missing or too old, install via your package manager. On Ubuntu or Debian:
sudo apt update
sudo apt install python3 python3-pip
Verify your install
Open a terminal and run:
python --version
On macOS or Linux you may need:
python3 --version
Either way you should see something like Python 3.11.5. If you do, the install worked.
Install VS Code (recommended editor)
- Visit https://code.visualstudio.com
- Download for your operating system and run the installer
- Open VS Code
- Click the Extensions icon in the left sidebar (it looks like four little squares)
- Search for "Python"
- Install the official Python extension by Microsoft (it has a blue verified tick)
Your first Python file
- Create a folder called
PythonProjectssomewhere you can find it again - Open VS Code, choose File > Open Folder, and pick that folder
- Create a new file called
hello.py - Type one line into it:
print("Hello, World!")
- Save the file (Ctrl+S on Windows, Cmd+S on Mac)
- Open a terminal inside VS Code: Terminal > New Terminal from the menu bar
- Run:
python hello.py
You should see Hello, World! print in the terminal.
If something goes wrong
Setup is where new programmers get most stuck. The three problems we see most often:
| Problem | Try this |
|---|---|
'python' is not recognized as an internal or external command | Python was not added to PATH. Uninstall it from Control Panel, then reinstall and check the "Add python.exe to PATH" box. |
python --version shows Python 2.x | You have an old Python. Install Python 3 from python.org and use python3 instead. |
| VS Code does not recognise Python | Reload VS Code (Ctrl+Shift+P then "Reload Window"). If the Python extension still does not pick up your install, check View > Output > Python for hints. |
If you get stuck for more than 20 minutes on the same setup issue, ask in the community forum. Setup problems are usually environment-specific and someone else has hit yours before.
What's next
You have Python installed, an editor that understands it and a working "Hello, World!" file. The next lesson opens the Python interactive shell, the fastest way to experiment with the language and see how it thinks.