← Back More Python posts Home

How to Install Python and VS Code on Windows

November 12, 2026

Before you write your first Python program, you need two things on your computer: Python and a code editor. Python runs your code. The code editor is the place where you write it. In this guide, we will install both on Windows, one small step at a time. It takes about 10 to 15 minutes.

How to install Python and VS Code on Windows
In this post, you will learn:
  • How to download and install Python on Windows
  • How to install VS Code and the Python extension
  • How to write and run your first Python program
  • How to fix the most common errors

What You Need

  • A Windows 10 or Windows 11 computer
  • An internet connection
  • About 1 GB of free space

Step 1: Download Python

  1. Open your browser and go to python.org.
  2. Click on Downloads in the top menu.
  3. Click the big yellow button that says Download Python 3.x.x. The numbers can be different, because the website always shows the latest version.
  4. Wait for the file to finish downloading. It is usually saved in your Downloads folder.
Download Python from python.org
Tip: Always download Python from python.org only. Do not use other websites.

Step 2: Install Python (Very Important Step)

  1. Open your Downloads folder and double-click the Python file you just downloaded.
  2. A setup window will open. Before you click anything, look at the bottom of the window.
  3. Tick the box that says "Add python.exe to PATH". This is the most important step. If you forget it, Python will not work in the terminal.
  4. Now click Install Now.
  5. If Windows asks "Do you want to allow this app to make changes?", click Yes.
  6. Wait for the installation. When you see "Setup was successful", click Close.
Tick Add python.exe to PATH in Python installer
Python setup was successful

What is PATH? PATH is a list of places where Windows looks for programs. When you add Python to PATH, Windows can find Python when you type the word python.

Step 3: Check That Python Is Installed

  1. Press the Windows key on your keyboard.
  2. Type cmd and press Enter. A black window (Command Prompt) will open.
  3. Type this and press Enter:
python --version

If you see something like Python 3.13.0, Python is installed correctly. Your number can be different, and that is fine.

python --version in Command Prompt

If you see an error instead, do not worry. Scroll down to the section "Common Errors and How to Fix Them".

Step 4: Download and Install VS Code

VS Code (Visual Studio Code) is a free code editor made by Microsoft. It colors your code, finds mistakes, and makes writing code easier than Notepad.

  1. Go to code.visualstudio.com.
  2. Click Download for Windows.
  3. Open the downloaded file from your Downloads folder.
  4. Select "I accept the agreement" and click Next.
  5. Keep clicking Next until you see the "Select Additional Tasks" page. Tick these three boxes: Add "Open with Code" action to Windows Explorer file context menu, Add "Open with Code" action to Windows Explorer directory context menu, and Add to PATH (it is usually ticked already).
  6. Click Next, then Install.
  7. When it finishes, click Finish. VS Code will open.
Download VS Code for Windows
VS Code installer additional tasks

Step 5: Install the Python Extension in VS Code

An extension is a small add-on. The Python extension helps VS Code understand Python code.

  1. In VS Code, click the Extensions icon on the left side. It looks like four small squares. You can also press Ctrl + Shift + X.
  2. In the search box, type Python.
  3. Choose the first result made by Microsoft.
  4. Click the blue Install button.
Install Python extension in VS Code

Step 6: Create a Folder and Your First Python File

It is good to keep all your practice files in one folder. Follow these steps:

  1. On your Desktop, right-click and choose New > Folder. Name it python-practice.
  2. In VS Code, click File > Open Folder. Select the python-practice folder and click Select Folder.
  3. If VS Code asks "Do you trust the authors of the files in this folder?", click Yes, I trust the authors.
  4. In the left panel, click the New File icon and name the file hello.py. The .py at the end is very important. It tells the computer that this is a Python file.
  5. Type the code below in the file, then press Ctrl + S to save it.
print("Hello, world!")
hello.py file in VS Code

Step 7: Run Your First Program

There are two easy ways to run your code.

Method 1: Use the Run button. Look at the top right corner of VS Code. Click the small triangle (Play) button. A terminal will open at the bottom and show your result.

Method 2: Use the terminal. In VS Code, click Terminal > New Terminal in the top menu. Then type this and press Enter:

python hello.py

You should see this output:

Hello, world!
Hello world output in VS Code terminal

Congratulations! You have installed Python and VS Code, and you have run your first program.

Common Errors and How to Fix Them

Error 1: 'python' is not recognized as an internal or external command

This means Python was installed without PATH. To fix it:

  1. Search "Python" in the Start menu and open the installer again.
  2. Click Uninstall to remove Python.
  3. Install it again, and this time tick "Add python.exe to PATH".
  4. Close all terminal windows, open a new one, and try again.

You can also try py --version. On Windows, py often works even when python does not.

Error 2: Microsoft Store opens when I type python

Windows has a shortcut that opens the Store. To turn it off:

  1. Press the Windows key and type Manage app execution aliases. Open it.
  2. Turn OFF the two items named python.exe and python3.exe (App Installer).
  3. Open a new terminal and try again.

Error 3: The Run (Play) button is not showing

Check these things:

  • Check that your file name ends with .py.
  • Check that the Python extension is installed (Step 5).
  • Restart VS Code.

Error 4: VS Code cannot find Python

To fix it:

  1. Press Ctrl + Shift + P.
  2. Type Python: Select Interpreter and press Enter.
  3. Choose the Python version from the list.

Common Mistakes Beginners Make

  • Forgetting to tick "Add python.exe to PATH". This is the number one mistake.
  • Forgetting to save the file. Press Ctrl + S before you run the code.
  • Saving the file as hello.py.txt. Make sure the file ends with only .py.
  • Typing the code with wrong quotes. Use simple straight quotes like "Hello".
  • Not using a folder. Keep all your practice files in one folder so you can find them easily.

What to Learn Next

Now your setup is ready. The next step is to learn variables and data types. Variables are like boxes where you store numbers and text. Read my post Python Variables and Data Types Explained with Examples to learn them with simple examples. If you missed the full learning plan, read my Python roadmap for beginners first.

Frequently Asked Questions (FAQs)

Is Python free to download?

Yes. Python and VS Code are both free. Download them only from python.org and code.visualstudio.com.

Why do I need to tick "Add python.exe to PATH"?

It lets Windows find Python when you type python in the terminal. Without it, you will see the "not recognized" error.

Can I use another editor instead of VS Code?

Yes. You can use PyCharm, IDLE or any other editor. I suggest VS Code because it is free, light and easy for beginners.

Do I need internet to write Python code?

You need internet only to download Python and VS Code. After that, you can write and run code without internet.

Final Thoughts

Setting up your tools is the hardest part for many beginners, and you have just finished it. If you get any error, read the message slowly and check the fixes above. Most problems are small, and almost all of them are solved by the PATH step. Keep practicing a little every day, and write your own print() lines in hello.py to get comfortable.

Enjoyed this post? Keep learning with more tutorials

← Back More Python posts All Categories

Comments

← Back