PythonBasicsbeginner

Install Python on Windows and Run First Program

Download and install Python on Windows, add it to PATH, write and run your first program, and fix the most common setup errors.

Published
TL;DR – Quick Answer

To install Python on Windows, download the latest Python 3 installer from python.org, run it, tick "Add python.exe to PATH" on the first screen and click Install Now. Then open Command Prompt and type python --version to check it. Save print("Hello, World!") in a file called hello.py and run it with python hello.py.

On This Page

Before you can write Python programs on your laptop, you need to install Python. This takes about ten minutes. This page walks you through each screen of the installer on Windows 10 or 11, then shows you how to write and run your first program.

At the end there is a section on fixing the most common problem: 'python' is not recognized as an internal or external command.

What you need

  • A Windows 10 or Windows 11 laptop or desktop.
  • An internet connection to download the installer (a few tens of MB).
  • Permission to install software. On a college lab PC, ask the lab staff.

You do not need to know any programming. If you are still deciding whether Python is the right language for you, read what Python is used for first.

Step 1: download Python from python.org

  1. Open a browser and go to python.org.
  2. Point at the Downloads menu. The site detects Windows and shows a button for the latest Python 3 release.
  3. Click the button. A file with a name like python-3.x.y-amd64.exe downloads to your Downloads folder.

The exact version number changes a few times a year. Any recent Python 3 version is fine for learning. Do not install Python 2. It is no longer supported.

Pro tip: Download only from python.org or the Microsoft Store. Other "free download" sites sometimes bundle unwanted software with the installer.

Newer python.org pages may also offer the Python install manager, a tool that installs and updates Python versions for you. If that is what your download gives you, run it and follow its prompts. The steps below describe the classic installer, which most college guides and lab PCs still use.

Step 2: run the installer and add Python to PATH

Double-click the downloaded file. The first screen of the installer is the most important one.

What you see on the first screen:

Install Python 3.x.y (64-bit)

  -> Install Now
     C:\Users\<your name>\AppData\Local\Programs\Python\Python3xx

  -> Customize installation

  [x] Use admin privileges when installing py.exe
  [ ] Add python.exe to PATH        <-- tick this box
  1. Tick "Add python.exe to PATH" at the bottom. It is unticked by default. This one box decides whether the python command will work later.
  2. Click Install Now.
  3. If Windows asks "Do you want to allow this app to make changes to your device?", click Yes.
  4. Wait for the progress bar to finish.
  5. On the last screen you may see Disable path length limit. Clicking it is safe and avoids errors with long folder names later. Then click Close.

Step 3: check that Python is installed

Open Command Prompt. Press the Windows key, type cmd and press Enter. A black window opens. Type this and press Enter:

python --version

You should see the version you installed, for example:

Python 3.14.4

Your number may be different. Any Python 3.x.y line means Python is installed and on PATH. Also check pip, the tool that installs extra Python libraries:

pip --version

It prints a line starting with pip followed by its version and folder. If either command says "not recognized", jump to the troubleshooting section below.

Windows also installs the Python launcher, py. Typing py --version works even when PATH is not set, so it is a useful backup.

Step 4: try the Python shell

Type python on its own and press Enter. You are now inside the Python shell, also called the REPL. The >>> prompt means Python is waiting for a line of code.

>>> print("Hello, World!")
Hello, World!
>>> 2 + 3
5
>>> 10 / 4
2.5
>>> exit()

The shell runs each line as soon as you press Enter. It is good for quick tests. Type exit() to return to the normal Command Prompt.

Step 5: write your first program in a file

Real programs are saved in files ending in .py, so you can run them again.

  1. Create a folder for your practice, for example C:\python-practice.
  2. Open IDLE from the Start menu. It was installed with Python. Choose File > New File.
  3. Type this program:
print("Hello, World!")
print("I just ran my first Python program.")
  1. Choose File > Save As, open your practice folder and save the file as hello.py.
  2. Press F5 (or Run > Run Module). The output appears in the IDLE shell window:
Hello, World!
I just ran my first Python program.

print() shows whatever you put inside the brackets. Text must be inside quotes. Each print() starts on a new line.

Step 6: run the program from Command Prompt

You can also run any .py file from Command Prompt. Move into your folder with cd, then type python and the file name:

cd C:\python-practice
python hello.py

Output:

Hello, World!
I just ran my first Python program.

Now make the program talk to you. Save this as greet.py:

name = input("What is your name? ")
year = int(input("Which year of college are you in? "))

print("Hello,", name)
print("Only", 4 - year, "years left to graduate.")

Sample run:

What is your name? Ravi
Which year of college are you in? 2
Hello, Ravi
Only 2 years left to graduate.

input() waits for the user to type something and press Enter. It always returns text, so int() turns the year into a number before the subtraction. Python runs this file line by line through its interpreter, with no separate compile step. Compiler vs interpreter explains the difference.

Fix: 'python' is not recognized

This is the most common setup error on Windows. Command Prompt shows:

'python' is not recognized as an internal or external command,
operable program or batch file.

It means Windows cannot find python.exe in any folder on PATH. Try these fixes in order.

Fix What to do
1. Reopen Command Prompt PATH changes only apply to new windows. Close every Command Prompt and open a fresh one
2. Try the launcher Type py --version. If it works, use py hello.py instead of python hello.py for now
3. Repair the install Run the installer again, choose Modify, click Next, and tick Add Python to environment variables. Then click Install
4. Add PATH by hand Search Windows for "environment variables", open Edit the system environment variables, click Environment Variables, select Path under your user, click Edit and add the two folders shown below
5. Reinstall Uninstall Python from Settings, then install again and tick Add python.exe to PATH

The two folders for fix 4 look like this, with your own user name and version number:

C:\Users\<your name>\AppData\Local\Programs\Python\Python3xx\
C:\Users\<your name>\AppData\Local\Programs\Python\Python3xx\Scripts\

The first folder holds python.exe. The second holds pip.exe.

Typing python opens the Microsoft Store

If typing python opens the Microsoft Store instead of showing an error, Windows is using an app execution alias. Go to Settings > Apps > Advanced app settings > App execution aliases and turn off python.exe and python3.exe (they are labelled "App Installer"). Then reopen Command Prompt.

Other common setup problems

Problem Cause Fix
can't open file '...\hello.py': [Errno 2] No such file or directory You are in a different folder from the file cd into the folder that has the file, or type the full path
The file is saved as hello.py.txt Notepad added .txt In Notepad's Save dialog, set "Save as type" to All files. Turn on file name extensions in File Explorer to check
SyntaxError on python hello.py inside the shell You typed the command at the >>> prompt Type exit() first, then run the command in the normal Command Prompt
pip is not recognized The Scripts folder is not on PATH Use py -m pip instead, or add the Scripts folder to PATH

What to install next

  • VS Code is a free editor from Microsoft. Install the Python extension inside it, open your practice folder and press the Run button at the top right to run a file.
  • Learn the basics in this order: variables and data types, if else statements, loops, lists, dictionaries and functions.

Python is a good first language, but many colleges start with C. If you are choosing, read C vs Python for first year. When you are ready to plan beyond the basics, follow the Python developer roadmap.

Frequently Asked Questions

Is Python free to download?
Yes. Python is free and open source. Download it only from the official site, python.org, or the Microsoft Store, not from random download sites.
Which Python version should I install?
Install the latest stable Python 3 release shown on python.org. Python 2 is no longer supported. Course material written for any recent Python 3 version works on the latest one for beginner programs.
What does Add python.exe to PATH do?
PATH is a list of folders Windows searches when you type a command. Adding Python to PATH lets you type python in any Command Prompt window instead of the full path to python.exe.
Why does typing python open the Microsoft Store?
Windows has a shortcut called an app execution alias that points python to the Store when Python is not on PATH. Install Python and add it to PATH, or turn off the python.exe and python3.exe aliases in Settings, under Apps, Advanced app settings, App execution aliases.
Do I need an editor to write Python?
No. Python comes with IDLE, a simple editor, and you can even use Notepad. Most students move to a free editor such as VS Code after the first week because it highlights mistakes and indents code for you.

Want to Build Your Career in Data Science with AI?

Join CodeBegun and train with working industry engineers — Explore the Data Science program

Apply for Demo Class →
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 5 December 2026 LinkedIn
Chat with us