Setup on Windows: Python, VS Code and Git
Install Python with the Python Install Manager, VS Code with its Python extension, and Git on Windows with winget, check them with py --version and python --version in VS Code's terminal, tell Git your name and email, and make a python-course folder.
Novice · Python · Software Development · Git · Updated
After this lesson you can
- Name the tools this setup installs on Windows (the Python Install Manager, VS Code and its Python extension, and Git) and say what each one is for
- Check a Windows setup in VS Code's terminal with py --version, python --version and git config --global --list, and read what each answer means
Key takeaways
- The Python Install Manager installs Python on Windows and gives you two commands, py and python, that both run it.
- VS Code is the code editor, its Python extension helps it understand Python, and its terminal, PowerShell on Windows, is where you run your programs.
- py --version and python --version print the version of Python the terminal finds. An error such as "not recognized" means it can't find Python yet.
- Git copies exercise code from GitHub and sends your work back. git config --global tells it your name and email once, for every project.
- Every example and exercise goes in one folder, python-course, in your home folder.
Every Python program you'll write, from a three-line greeting to a script that sorts a thousand files, runs on the same few tools: Python itself, an editor to write the code in, and a terminal to run it, plus Git, to get exercise code and hand your work in. Setting them up on a Windows computer takes about half an hour, once. On a Mac, Setup on a Mac: Python, VS Code and Git is the lesson to follow instead.
What you're installing, and why
| Tool | What it's for | Cost |
|---|---|---|
| Python, from the Python Install Manager | Python is the interpreter that runs your programs. The install manager is python.org's way to install it on Windows, and gives you the commands py and python. |
Free |
| VS Code | A code editor: a text editor made for code. It colors your code so it's easier to read and underlines some mistakes as you type. | Free |
| VS Code's Python extension | An add-on, by Microsoft, that teaches VS Code about Python: it finishes names as you type, points out mistakes and runs your programs. | Free |
| VS Code's terminal | A window where you type a command, press Enter and read the answer. On Windows it runs PowerShell. | Comes with VS Code |
| Git | Copies exercise code from GitHub to your computer, and sends your finished work back. Git Credential Manager comes with it, to sign you in to GitHub. | Free |
Install them with winget
winget is the Windows Package Manager, built into Windows: it installs a program when you type its name. Open the Terminal app (open the Start menu and type terminal), type each line below and press Enter. Click Yes if Windows asks whether the app may make changes.
winget install -e --id Python.PythonInstallManager
winget install -e --id Microsoft.VisualStudioCode
winget install -e --id Git.Git
-e --id (read "dash e, dash dash id") asks for exactly the package with that name. Then close the Terminal app and open a new one, so it finds the new commands, and install Python itself with the install manager:
py install 3.15
It downloads Python 3.15 and sets it up. If it asks whether to add a folder to your PATH, you can say yes or no: this course only uses py and python, which work either way.
No winget, or it isn't recognized? The download pages work too: the Python install manager at python.org/downloads, VS Code at code.visualstudio.com, and Git at git-scm.com. Accept the suggested settings in each installer.
Check it in VS Code's terminal
Open VS Code. Click the Extensions button on the left (four small squares), or press Ctrl+Shift+X, search for Python, and click Install on the one by Microsoft.
Now open VS Code's own terminal: choose Terminal > New Terminal. A panel opens at the bottom of the window, with PowerShell waiting. Type each command and press Enter:
py --version
python --version
--version is read "dash dash version": it asks a program which version it is. If you installed Python 3.15.2, the version this course was checked with, both answer:
Python 3.15.2
Python 3.15.2
A newer number works too, and so does any Python from 3.12 on. py and python run the same Python; lessons write python.
Then make the folder every example and exercise goes in, and open it:
mkdir ~/python-course
~ (read "tilde") means your home folder, C:\Users\<you>. PowerShell prints a few lines about the new folder. Choose File > Open Folder, open python-course, and if VS Code asks whether you trust the authors of the files, choose Yes: they're yours.
Tell Git who you are, and make a GitHub account
Git writes a name and an email on every snapshot of your work it saves. In VS Code's terminal, with your own name and email in place of the examples:
git config --global user.name "Sam Lee"
git config --global user.email "sam.lee@example.com"
git config --global init.defaultBranch main
--global means for every project on this computer, so you do it once. The third line names a new project's first branch main, the name GitHub uses. None of them prints anything. To fix a typo, run its line again. Check them:
git config --global --list
user.name=Sam Lee
user.email=sam.lee@example.com
init.defaultbranch=main
Then make a free account at github.com/signup, with the same email, so GitHub links your work to you. Pick a username you'd be happy to show someone you'd like to work for: it's part of every address of your work, such as github.com/your-name/exercise-name.
If something goes wrong
| What you see | What to do |
|---|---|
The term 'py' is not recognized or The term 'python' is not recognized |
The terminal can't find Python yet. Close VS Code completely, open it again and retry. Still there? Run the winget install line for the install manager again. |
Typing python opens the Microsoft Store |
Open the Start menu, search for Manage app execution aliases, and turn on the two Python (default) entries. Then open a new terminal. |
python --version prints Python 3.11 or lower |
An older Python is installed and found first. Run py install 3.15, then check again; if it's still old, uninstall the old Python in Settings > Apps. |
Check yourself
2 questions to try on the lesson page.
So what
Python, VS Code with its Python extension, and Git are the kit every Python project starts from, and the same kit professional Python developers use every day.