Quick Links

Key Takeaways

To install Python on Windows, download the latest version of Python from the Python website, then run the installer. Ensure that you add Python to the PATH when presented with the option.

Python doesn't come prepackaged with Windows, but that doesn't mean Windows users won't find the flexible programming language useful. It's not quite a simple as installing the newest version however, so let's make sure you get the right tools for the task at hand on Windows 10 or Windows 11.

What Is Python?

First released in 1991, Python is a popular high-level programming language used for general purpose programming. Thanks to a design philosophy that emphasizes readability it has long been a favorite of hobby coders and serious programmers alike. Not only is it an easy language (comparatively speaking, that is) to pick up but you'll find thousands of projects online that require you have Python installed to use the program.

Which Python Version Should You Use?

In general, you should just download and install the latest version of Python. You'll see a big banner at the top indicating the latest version of Python on the main download page. Click "Download Python 3.x.x."

The latest download available for Windows.

Unfortunately, there was a significant update to Python several years ago that created a big split between Python versions. This can make things a bit confusing to newcomers, but here is what you need to know.

There were two versions of Python maintained concurrently for many years: Python 2 and Python 3. Python 2 is officially deprecated. and has been since 2020. You'll still find loads of older projects that use it scattered around the internet, though the overwhelming majority of new projects opt for Python 3 since it is still receiving updates.

If you're looking to learn Python, you should skip Python 2 entirely and stick to Python 3. There are some noteworthy technical differences between Python 2 and 3. Suffice it to say, Python 3 is typically easier to read and write, faster, and has more community support than Python 2. They're also similar enough that learning Python 3 will enable you to work with Python 2 without too much of a problem, if it is absolutely necessary.

You'll see the division if you scroll down a bit when you visit the Python for Windows download page.

Multiple Python versions are still available.

You can download just Python 2 or Python 3 if you're sure you only need a particular version. We're going to be showing you how to install the latest version of Python 3, however the installation process for Python 2 is basically the same.

This installer will install the appropriate 32-bit or 64-bit version on your computer automatically (here's some further reading if you want to know more about the differences between the two).

How to Install Python 3

First, download the latest version of Python 3 if you haven't already, then run the executable.

You can install the latest version of Python 3 alongside Python 2 or even older versions of Python 3 with no problems. Just make sure the right one is on your PATH.

On the first screen, enable the "Add Python.exe PATH" option and then click "Install Now."

Ensure "Add Python to PATH" is ticked, then click "Install Now."

Next, you have a decision to make. Clicking the "Disable path length limit" option removes the limitation on the MAX_PATH variable. This change won't break anything, but will allow Python to use long path names. Since many Python programmers are working in Linux and other *nix systems where path name length isn't an issue, turning this on in advance can help smooth over any path-related issues you might have while working in Windows.

We recommend go ahead and selecting this option. If you know you don't want to disable the path length limit, you can just click "Close" to finish the installation. And, if you want to read more about the issue before committing to the change, read up here.

If you're only installing Python 3, you can run python --version in any command line (like PowerShell or Command Prompt) to check that it is installed, and the path variable is set. If everything worked correctly, you'll see the version of Python you just installed shown.

Enter "python --version" in Command Prompt, PowerShell, or Windows Terminal to verify that Python was correctly added to the path.

If that doesn't work, you probably forgot to tick the box next to "Add Python.exe to PATH" during installation. No big deal—we'll show you how to add it manually in the next section.

Add Python to PATH Manually

If Python doesn't work when you run python --version or try to run a Python script, it probably wasn't added to your PATH. Windows PATH specifies what folders Windows should check for executables. If a folder is included, any executable in that folder can be run from a command-line without specifying the full path every time.

Click the Start Button, then search for and launch "Advanced System Settings."

Search for "View Advanced System Settings" in the Start Menu.

Click "Environment Variables," then select "Path" under User Variables and hit "Edit."

Select "Path," then click "Edit."

If Python is on your PATH, you should see two entries as shown in the image below. The first entry on our list—the scripts subfolder—adds pip to the PATH. Pip is Python's built-in package manager and is essential if you want Python to work correctly.

The second entry contains the actual Python executable, plus a few others that are important.

Pip is technically a recursive acronym for "Pip Installs Packages." As weird as that might seem, recursive acronyms are pretty common in the computer world. GNU, ATI, cURL, Nano, and PHP are all examples of recursive acronyms, too.

The two paths that must exist for Python to function correctly.

If you don't have those, then Python wasn't added to your PATH, and you'll need to address that. Click "New," then enter the path to your Python installation. Typically, it is the C:\Users\(YourUserName)\AppData\Local\Programs\Python\(PythonVersion)" folder, but it could be elsewhere if you changed the location during installation. Make sure to add the scripts subfolder too --- it provides important functionality.

What If You Have Multiple Versions of Python Installed?

You may also discover that you have multiple versions of Python installed when you start poking around your Python folder or looking at your PATH. Having multiple versions of Python installed concurrently isn't typically an issue. On occasion you may try to run a Python application that gives you an error if you're using an incompatible version of Python.

In that case, the solution is simple—switch your Python version. Sometimes you'll get an error that directly states what version you should be using. In those instances, make sure that the correct version of Python is installed and set on your PATH. Other times, you'll get less helpful errors. As an example, the AUTOMATIC1111 fork of Stable Diffusion requires PyTorch, a Python library, to run. PyTorch (at the time of writing) is not available on Python 3.12. Consequently, if you try to run Stable Diffusion on Python 3.12 you'll get an error about PyTorch being missing.

There isn't always an easy way to know what errors occur because of a problem with your Python version and what errors occur because of some other reason. In our Stable Diffusion example, the only way you'd know that Python 3.12 was the problem would be if you knew what Stable Diffusion required and that it wasn't available for Python 3.12 yet. Your best bet is to try searching the Internet for your specific error. Usually someone has encountered it (or something similar) and you'll be able to figure out a solution from there.

Don't Mess With Your System Install, Use Python Virtual Environments Instead

This section is only relevant if you're planning on actually coding with Python. If you're not actively using it, you can ignore this section.

If you're learning Python, you might be told to install a variety of packages as part of a tutorial. Do not install the modules or packages directly to your "system install" of Python. Modules and packages sometimes conflict with each other and with the version of Python you have installed on your system. If there is a compatibility problem, it can cause instability or bugs when you try to use Python. You should use Python's built-in virtual environments instead.

Python lets you create a small virtual environment for each project that you're working on. Each virtual environment can have its own Python version, separate packages and modules, and other variables. That lets you keep the dependencies for each project separate from each other and from your system installation. This ensures that compatibility problems won't affect the primary Python installation on your PC, and that it doesn't become a bloated mess of extra packages and modules.

There are a few ways to create and manage virtual environments. The first, and most basic, is venv. Venv is supplied with every modern Python install and can be used through the command line. VirtualEnv, which is a third-party virtual environment manager, provides slightly more robust functionality, and has better backwards compatibility with older versions of Python.

Alternatively, you can use an Integrated Development Environment (IDE). IDEs provide all sorts of helpful features if you're coding, and in the case of Python, most include tools to create and manage virtual environments for your projects. There are a ton of good IDEs out there, but we like PyCharm. It is free for personal use and has every feature an aspiring coder could ever want.