Skip to content
ChaiBytes

How to Install Python on Windows and Write Your First Line of Code

You will be able to install Python on Windows, check that it works, set up Visual Studio Code and write your first small line of Python.

By Ali RazaOfficial admin

3 min read 1 view

Share

What you need

  • A Windows computer that you are allowed to change, such as your own home machine or a device your school or workplace has approved for installs.
  • Access to the Microsoft Store, or the installer from python.org if you prefer that route.
  • Windows Terminal, which you can open to reach PowerShell.
  • An internet connection to download Python and Visual Studio Code.

Step by step

  1. Find Python in the Microsoft Store. The Store version is the simplest option for a first install. It sets up your PATH (the list of places Windows looks for programs) and handles updates for you.
  2. Install Python from the Store. Follow the prompts until the install finishes. You do not need to change any settings for a first setup.
  3. Open Windows Terminal and start PowerShell. PowerShell is where you type commands. Windows Terminal is the window that holds it.
  4. Close PowerShell and open it again. A fresh window makes sure it picks up the new Python install.
  5. Type python --version and press Enter. If Python is installed, the screen shows a version number. If you see an error, read the tips below before trying again.
  6. Download Visual Studio Code. Go to its official download page and choose the Windows version. This is the editor where you will write your code.
  7. Install Visual Studio Code. Run the downloaded file and follow the installer.
  8. Add the Python extension in Visual Studio Code. Open the Extensions panel, search for the Python extension and install the one from the VS Code Marketplace. This gives the editor tools for Python.
  9. Type your first line of code. Create a new Python file in Visual Studio Code and type a path as a raw string. For example, if you were organising trip photos, you might type r"C:\Users\MyName\Documents\Document.txt" (replace the path with your own). The letter r before the quotation mark tells Python to read the backslashes as plain characters, not as special codes.
  10. Check the path for backslash problems. If your path ends with a backslash, remove that last one before you save the line. Backslashes in Windows paths are a common source of errors.

Tips and common mistakes

  • Version commands can differ. Some Python setups use python3 instead of python. The Microsoft Store version is one of those cases, so if python --version fails, try python3 --version and see which one works.
  • Choose one install route. If you install from python.org, tick the option to add Python to PATH. The py launcher works only with python.org installs. It is not included with the Store version.
  • Use pathlib for file paths. Python’s standard pathlib module lets your code handle forward and back slashes in the same way. It is a good habit once your first line works.
  • Do not install into protected folders. If an install fails because it cannot change a location, a virtual environment is the suggested fix.
  • Read errors slowly. A failed install often needs the package’s own developer to help, not a quick fix from you.

If you get stuck, you can ask an AI helper for a plain explanation. Try this prompt:

I am a beginner on Windows. I installed Python from the Microsoft Store. Explain in plain English what the output of python --version means, and what I should do if it shows an error. If you are not sure, say so and tell me to check the official Python documentation.

Use it responsibly

Always check AI answers against the official sources before you rely on them, because an assistant can sound confident and still be wrong. Do not paste private data, such as passwords, personal photos, bank details or work files, into an AI tool or a code file you share. Keep your Microsoft account and any tool accounts secure with a strong, unique password and two-step sign-in where it is offered. Follow the rules of your workplace or school and the terms of each service you use, including Microsoft Store and the Visual Studio Code marketplace.

Sources

  1. 1. Python on Windows for beginners | Microsoft Learn — Microsoft Learn
  2. 2. I'm learning Python from scratch., - Python Help - Discussions on Python.org — Python.org

Drafted with AI assistance from the reports above and checked automatically for sourcing. Always confirm dates, fees and requirements on the official website before acting.

Was this helpful?

Comments

No comments yet. Share a question or what you know.

Leave a comment

Be respectful. Comments with links are reviewed before they appear. Your email is used only to contact you about your comment.