Installing Python on Windows with Python Manager and Visual Studio Code

Installing Python on Windows with Python Manager and Visual Studio Code

This walkthrough shows the full process for getting Python ready on a Windows computer. We will install Python from the official Python website, use Python Manager to install a Python runtime, install Visual Studio Code, create a small project folder, write a first script, and run it from the VS Code terminal.

By the end, the system should be able to:

1. Download Python Manager from python.org

Start at the official Python website: python.org. From the Windows download area, choose the current Windows download option.

Python download page

The download used here is the Python Install Manager package. This installs the py command, which can then download and manage Python runtimes for you.

2. Install Python Install Manager

Open the downloaded Python Manager installer.

Install Python Install Manager prompt

Leave Launch when ready selected if you want Python Manager to open after installation, then select Install Python.

3. Let Python Manager configure the system

After the installer runs, Python Manager opens in a terminal window. It may report that the global commands directory is not configured yet.

Python Manager terminal after install

If Python Manager asks to add its command directory to PATH, allow it. This is what makes commands like py available from normal terminals.

You may see a message explaining that configuration changed and the terminal needs to be restarted before the new setting is available.

Python Manager PATH message

Close and reopen the terminal when prompted so Windows can load the updated environment variables.

4. Install the latest Python runtime

In the Python Manager terminal, install Python by running:

py install

Running py install

When Python Manager asks whether to install CPython, type y and press Enter.

Python Manager installing CPython

CPython is the standard Python runtime most people mean when they say “Python.” After it installs, Python Manager can show installed runtimes and available commands.

5. Download Visual Studio Code

Next, install a code editor. Go to the Visual Studio Code website and download the Windows installer.

Visual Studio Code download page

The downloads folder now contains both installers: the Python Manager package and the VS Code installer.

Downloads folder with Python Manager and VS Code installers

Downloaded installer files

6. Run the VS Code installer

Open the Visual Studio Code installer. On the license agreement screen, choose I accept the agreement, then select Next.

VS Code license agreement

Choose the install location. The default location is fine for most systems.

VS Code destination folder

Choose the Start Menu folder. Again, the default is usually fine.

VS Code Start Menu folder

On the additional tasks screen, enable the useful Explorer and PATH options:

VS Code additional tasks

Review the setup summary, then select Install.

VS Code ready to install

Wait for the installer to finish copying files.

VS Code installing

When setup completes, leave Launch Visual Studio Code selected and select Finish.

VS Code setup complete

7. Start Visual Studio Code

When VS Code opens for the first time, it may offer account sign-in or sync setup.

Authorize Visual Studio Code account prompt

Signing in is optional. You can continue without sign-in if you only want to write and run local Python files.

After that, VS Code opens to its welcome screen.

VS Code welcome screen

8. Restart Windows after PATH changes

Because both Python Manager and VS Code update command-line settings, restart Windows before continuing. This helps make sure new PATH entries are available everywhere.

Windows restart menu

After the restart, commands like py and code should be easier for Windows to find.

9. Optional: Run VS Code as administrator

If you want VS Code to open with administrator permissions, adjust the shortcut settings. Right-click the Visual Studio Code shortcut, open Properties, then select Advanced.

VS Code shortcut properties

VS Code shortcut details

In the Advanced Properties window, select Run as administrator, then choose OK.

VS Code advanced properties

This step is optional. For regular Python projects, VS Code does not usually need administrator permissions. Use it only when your workflow requires elevated access.

10. Create a Python project folder

Open File Explorer and create a folder for your Python work. In this example, the folder is:

C:\repos\pythonintro

Creating a Python project folder

Inside that folder, create a new Python file named:

intro.py

intro.py created in project folder

You can create the file from the Explorer context menu.

Creating a new file from the context menu

11. Open the folder in VS Code

Open Visual Studio Code and choose Open Folder.

Open folder in VS Code

When VS Code asks whether you trust the authors of the files in the folder, choose Yes, I trust the authors for folders you created yourself.

Trust folder prompt

VS Code then opens the folder and shows intro.py in the Explorer.

12. Write a first Python script

Open intro.py and add a small test script:

print("Python is working!")

# Let's also test variables and math
x = 10
y = 20
print("x + y =", x + y)

# And test importing a module
import math
print("Square root of 16 is", math.sqrt(16))

First Python script in intro.py

This script checks three important pieces:

13. Install the Python extension for VS Code

Open the Extensions view in VS Code and search for Python. Install the official Python extension published by Microsoft.

Python extension in VS Code

The Python extension gives VS Code language support, interpreter selection, debugging, and run commands for Python files.

Python extension install button

14. Open the Python project folder from the extension prompt

VS Code may show a Python welcome panel with an Open Project Folder button. Use it to open the folder where intro.py lives.

Python extension open project folder prompt

Select the folder you created earlier.

Selecting the pythonintro folder

15. Install a package management helper

In the Extensions view, search for Python package tools. This example installs Pip Manager, which gives a visual interface for working with Python packages.

Pip Manager extension page

You may also see related package tools in the Extensions list.

Python package extensions list

This is not required for running Python, but it can make package management easier while learning.

16. Review and run the script

Return to intro.py and make sure the file is saved.

intro.py open in VS Code

Open the VS Code terminal with Terminal > New Terminal. From the project folder, run:

py intro.py

If your terminal is already pointed at the project directory, this runs the script directly.

Running intro.py in the VS Code terminal

The output should look like this:

Python is working!
x + y = 30
Square root of 16 is 4.0

Successful Python output in terminal

17. Confirm Python runs from the command line

The final screenshot shows the script running successfully through the Python launcher. This confirms that Windows can find Python and that the project file runs correctly.

Final terminal confirmation

At this point, Python is installed, Visual Studio Code is installed, the Python extension is active, and a first script runs successfully.

Common checks if something does not work

If py intro.py does not run, try these checks:

Once those checks pass, the system is ready for Python development.

Comments

Questions, corrections, and notes are welcome here.