Install Python 3 and VS Code on Windows or macOS
You can learn Python syntax in a browser sandbox, but you cannot ship a real tool from one. Everything else in this course — reading CSV files, calling APIs, importing your own modules — assumes Python is installed on your own machine and that you have an editor that understands it. Let's get that sorted properly, once.
What you're installing and why
Two separate things:
- The Python 3 interpreter — the program that actually runs your
.pyfiles. It also bringspip, the tool that installs libraries likerequestsandpandas. - Visual Studio Code (VS Code) — a free code editor. It doesn't run Python by itself; it just gives you syntax highlighting, autocomplete, an integrated terminal and a debugger.
A lot of beginners install VS Code, open a file, press Run, get an error, and assume VS Code is broken. It isn't — Python just wasn't installed or wasn't found. Keep the two ideas separate in your head.
Data heads-up: the Python installer is roughly 25–30 MB and VS Code is about 100 MB, plus another 60–100 MB for the Python extension and its language server. Budget around 250 MB. If you're on a metered bundle, do this on campus Wi-Fi, at the office, or at a cyber café — and download both installers to a flash drive so you never have to fetch them twice.
Install Python 3 on Windows
Go to python.org/downloads and click the big yellow button for the latest Python 3 release (3.11 or newer is fine). Don't install Python from the Microsoft Store for this course — the store version sandboxes file access in ways that will confuse you later.
Run the installer. On the very first screen, before you click anything else:
- Tick "Add python.exe to PATH" at the bottom.
- Then click "Install Now".
That single checkbox is the difference between python working in your terminal and getting 'python' is not recognized as an internal or external command. If you already installed and forgot to tick it, re-run the installer, choose Modify, and add it — or simply uninstall and reinstall.
When it finishes, if you see an option labelled "Disable path length limit", click it. It prevents strange errors later when pip installs packages with deeply nested folders.
Now verify. Press Win + R, type cmd, press Enter, and run:
python --version
pip --version
You should see something like:
Python 3.12.4
pip 24.0 from C:\Users\Chidinma\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12)
If python --version opens the Microsoft Store instead of printing a version, Windows is using its "app execution alias". Go to Settings → Apps → Advanced app settings → App execution aliases and turn off the two entries called python.exe and python3.exe.
Install Python 3 on macOS
macOS ships with a system Python, but it's there for Apple's own use and may be an old version. Install your own.
The simple route: download the macOS 64-bit universal2 installer from python.org/downloads, open the .pkg, and click through. It installs to /Library/Frameworks/Python.framework and adds itself to your PATH automatically.
The route many developers prefer, if you already have Homebrew:
brew install python@3.12
Verify in Terminal (find it with Cmd + Space, type "Terminal"):
python3 --version
pip3 --version
Note the 3. On macOS, plain python may point to the old system version or to nothing at all. Throughout this course, when you see python in a Windows example, read it as python3 on macOS.
| Task | Windows | macOS |
|---|---|---|
| Terminal app | Command Prompt or PowerShell | Terminal |
| Run the interpreter | python | python3 |
| Install a package | pip install requests | pip3 install requests |
| Run a script | python app.py | python3 app.py |
| Path separator | C:\Users\Ada\code | /Users/ada/code |
Install VS Code
Download from code.visualstudio.com. On Windows, run the .exe and — important — tick "Add to PATH" and both "Open with Code" context-menu options during setup. On macOS, drag the app into your Applications folder.
Open VS Code. Click the Extensions icon in the left sidebar (the four squares), search for Python, and install the one published by Microsoft. It will pull in Pylance automatically. That's the only extension you need right now.
Wire them together and prove it works
Create a folder for this course. Put it somewhere sane — C:\Users\<you>\Documents\python-course or ~/Documents/python-course. Avoid folder names with spaces or apostrophes; they cause needless quoting headaches on the command line.
In VS Code: File → Open Folder, pick that folder. Always open the folder, not a single file — VS Code's Python tooling works per-project.
Create a new file called check_setup.py and paste:
import sys
import platform
print("Python version:", sys.version.split()[0])
print("Running from:", sys.executable)
print("Operating system:", platform.system(), platform.release())
naira_prices = {"rice_50kg": 78000, "garri_bag": 32000, "beans_mudu": 3500}
total = sum(naira_prices.values())
print(f"Total market spend: NGN {total:,}")
Now tell VS Code which Python to use. Press Ctrl + Shift + P (Cmd + Shift + P on macOS), type Python: Select Interpreter, and pick the version you just installed. If your interpreter doesn't appear, close VS Code completely and reopen it — it reads PATH at startup.
Run the file with the ▶ play button at the top right. In the integrated terminal you should see:
Python version: 3.12.4
Running from: C:\Users\Chidinma\AppData\Local\Programs\Python\Python312\python.exe
Operating system: Windows 10
Total market spend: NGN 113,500
The sys.executable line matters more than it looks. Later, when you create virtual environments, that line tells you at a glance whether you're inside the right one.
The four errors you're most likely to hit
| What you see | What it means | Fix |
|---|---|---|
'python' is not recognized... | PATH is missing | Re-run installer → Modify → tick Add to PATH, then restart the terminal |
python: command not found (macOS) | You typed python, not python3 | Use python3 |
| Store page opens instead of Python | Windows app execution alias | Turn off the python.exe alias in Settings |
| Code runs in terminal but VS Code says "module not found" | Wrong interpreter selected | Ctrl+Shift+P → Python: Select Interpreter |
One more habit: after changing PATH or installing anything, close every terminal window and open a fresh one. Terminals capture PATH when they start; an old window will keep lying to you.
Try it yourself
- Complete both installs and run
check_setup.py. - In your terminal, install one package to confirm pip works and reaches the internet:
pip install requests
(macOS: pip3 install requests.)
- Add these two lines to the top of
check_setup.py, then run it again:
import requests
print("requests version:", requests.__version__)
If all four values print — Python version, executable path, OS, and requests version — screenshot the terminal output. That screenshot is your proof of a working workspace, and you'll need requests in the API module. If any step fails, note the exact error text; it will match one of the rows in the table above.