Installing Python & VS Code
In this tutorial, we'll install Python, check it works, and set up VS Code.
Before you can write Python programs, your computer needs two things:
- Python itself, which understands and runs your code
- A code editor, where you write and save your programs
In this course we recommend Python 3 and Visual Studio Code. Python is the language runtime. VS Code is the editor. They are separate tools, but they work well together.
Installing Python
Go to [python.org](https://python.org) and download the latest Python 3 version for your computer.
On Windows, the most important step is ticking Add Python to PATH before clicking install. PATH is a system setting that lets your terminal find Python when you type commands like python or python3.
On macOS, run the downloaded .pkg installer. On Linux, Python is often already installed, but you can install it through your package manager if needed.
After installing, open a terminal and check the version:
python3 --version
You should see something like:
Python 3.12.4
On some Windows machines, this command may be:
python --version
If one command does not work, try the other. The goal is simply to prove that your computer can find Python.
Installing VS Code
Download VS Code from [code.visualstudio.com](https://code.visualstudio.com). Once installed, open VS Code and install the Python extension from Microsoft.
The extension gives you helpful features like:
- Syntax highlighting, so code is easier to read
- Error hints, so mistakes are easier to spot
- A run button for Python files
- Better support for Python projects
Your First Check
Create a file called hello.py and add:
print("Hello, Python!")
Run it from the terminal:
python3 hello.py
If it prints Hello, Python!, you are ready.
Common Problems
If your terminal says Python is not found, Python may not have been added to PATH. Reinstalling Python and ticking the PATH option usually fixes this on Windows.
If VS Code asks you to choose an interpreter, pick the Python 3 version you installed. An interpreter is the program that runs your Python code.
Practice
Create a folder for your Python learning. Inside it, create hello.py, print one message, and run it from the terminal.