Installing Python
Overview
To write and run Python on your own computer you need two things: Python itself (the program that runs your code) and a code editor (where you write it). This lesson gets both set up. It takes about 15 minutes.
Step 1: Install Python
Windows
Python on Windows is now installed with the Python install manager:
- Open the Microsoft Store, search for Python install manager, and install it. (It’s also available from python.org/downloads.)
- Open a terminal (Windows Terminal or PowerShell) and run:
py install 3.15The first time, the install manager runs a short configuration check and offers to fix common problems — accept its suggestions, including adding Python to your PATH.
- Close and reopen the terminal, then check:
python --version
# Python 3.15.2The py command manages versions (py list shows what’s installed; py -3.14 runs a specific one), while python runs the default.
macOS
macOS doesn’t come with a current Python. Either:
- download the macOS installer from python.org/downloads and run it, or
- if you use Homebrew:
brew install python@3.15.
Then, in Terminal:
python3 --version
# Python 3.15.2On macOS the command is usually python3 — python may not exist. Use python3 wherever this course says python.
Linux
Most distributions include Python 3, but often an older version. Check with python3 --version. For a current version, the easiest cross-distribution tool is uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.15Or use your distribution’s packages (sudo apt install python3 python3-venv on Ubuntu/Debian, sudo dnf install python3 on Fedora). Any version from 3.10 up works for this course.
Which version?
Any 3.10 or newer works for this course; 3.15 is recommended. Python releases a new version every October and supports each for five years, so the latest version is a good default.
Step 2: Install a code editor
You can write Python in any text editor, but a code editor makes life much easier: colours, auto-completion, error underlines and a Run button.
We recommend Visual Studio Code (free, all platforms):
- Install it from code.visualstudio.com.
- Open the Extensions panel and install Python (by Microsoft).
- Create a folder for this course, for example
python-coursein your Documents, and open it with File → Open Folder.
Other good choices: PyCharm Community (a full Python IDE), Thonny (very simple, made for beginners), or any editor you already like.
Step 3: Run your first file
- In VS Code, create a file
hello.pyin your course folder:
print("Hello from Python!")- Click the ▶ Run button at the top right, or open the terminal (View → Terminal) and type:
python hello.pyHello from Python!If you see that line, everything works.
Troubleshooting
| Problem | Fix |
|---|---|
python: command not found / 'python' is not recognized |
Python isn’t on your PATH. On Windows run py install --configure; on macOS/Linux try python3. Always reopen the terminal after installing. |
Typing python opens the Microsoft Store |
Windows’ placeholder “app execution alias”. Install the install manager, or turn the alias off in Settings → Apps → Advanced app settings → App execution aliases. |
| The version is older than expected | Several Pythons are installed. Check which one runs with python -c "import sys; print(sys.executable)", and choose the interpreter in VS Code with Python: Select Interpreter. |
can't open file 'hello.py' |
The terminal is in a different folder. cd into your course folder first, or use VS Code’s Run button. |
Online alternatives
If you can’t install software (a work laptop, a tablet), browser-based options let you follow most of this course: the editor at python.org/shell, Google Colab, GitHub Codespaces, or Replit. Later lessons on files and packages work best on your own machine.
Done? You have Python and an editor. Next: the two ways to run Python code — interactively and from files.
Check your setup
Create a file called check_setup.py in a new python-course folder and run it from your terminal. It should print the Python version you’re running, where the Python program lives on your computer, and your operating system — and print a warning if the version is older than 3.10, the oldest version this course supports.
# check_setup.py
import sys
import platform
# 1. Print the Python version (sys.version or platform.python_version())
# 2. Print where Python is installed (sys.executable)
# 3. Print the operating system (platform.system())
# 4. Warn if the version is older than 3.10 (sys.version_info)# check_setup.py
import sys
import platform
# 1. Print the Python version
print("Python version:", platform.python_version())
# 2. Print where Python is installed
print("Python program:", sys.executable)
# 3. Print the operating system
print("Operating system:", platform.system())
# 4. Warn if the version is older than 3.10
if sys.version_info < (3, 10):
print("Warning: please install a newer Python for this course.")
else:
print("Your Python is ready for this course.")Summary
- Install Python 3.15: the Python install manager on Windows, the python.org installer or Homebrew on macOS, your package manager or uv on Linux.
- Check the installation with
python --version(orpython3 --versionon macOS/Linux). - A code editor such as VS Code with the Python extension gives colours, error hints and a Run button.
- Keep your course work in one folder and open that folder in your editor.
- If the command isn’t found, Python isn’t on your PATH — rerun the installer’s configuration or reopen the terminal.