Document
How to Install Python on Windows

How to Install Python on Windows

Summary To install Python on Windows, download the latest version of Python from the Python website, then run the installer. Ensure that you add Py

Related articles

How to Watch Live NFL Games in 2024 on Sling TV Final Fantasy 7 Dresses: How to get all nine outfits for Cloud, Tifa and Aerith explained How Much is Photoshop in 2024? Rainy Cloud Jumper Use VPN on PS4 and PS5

Summary

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 release in 1991 , Python is is is a popular high – level programming language used for general purpose programming . thank to a design philosophy that emphasize readability it has long been a favorite of hobby coder and serious programmer alike . Not only is it is is an easy language ( comparatively speak , that is ) to pick up but you ‘ll find thousand of project online that require you have Python instal to use the program .

Which Python Version Should You is Use 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.”

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.

You is download can download just Python 2 or Python 3 if you ‘re sure you only need a particular version . We ‘re go to be show you how to install the late version of Python 3 , however the installation process is is 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 . “

Next , you is have have a decision to make . click the ” disable path length limit ” option remove the limitation on the MAX_PATH variable . This change is break wo n’t break anything , but will allow Python to use long path name . Since many Python programmer are work in Linux and other * nix systems where path name length is n’t an issue , turn this on in advance can help smooth over any path – relate issue you might have while work 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.

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 setting . “

click ” Environment variable , ” then select ” path ” under User Variables and hit ” edit . “

If Python is on your path , you is see should see two entry as show in the image below . The first entry is adds on our list — the script subfolder — add pip to the path . Pip is is is Python ‘s build – in package manager and is essential if you want Python to work correctly .

The second entry is contains contain 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.

If you do n’t have those , then Python was n’t add to your path , and you ‘ll need to address that . click ” New , ” then enter the path to your Python installation . typically , it is is is the c:\users\(yourusername)\appdata\local\programs\python\(pythonversion ) ” folder , but it could be elsewhere if you change the location during installation . Make sure to add the script subfolder too — it is provides provide important functionality .

What If You Have Multiple Versions of Python Installed?

You is discover may also discover that you have multiple version of Python instal when you start poke around your Python folder or look at your path . have multiple version of Python instal concurrently is n’ttypically an issue . On occasion you is try may try to run a Python application that give 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 learn Python , you might be tell to install a variety of package as part of a tutorial . Do not install the module or package directly to your ” system install ” of Python . Modules is conflict and package sometimes conflict with each other and with the version of Python you have instal on your system . If there is a compatibility problem , it is cause can cause instability or bug when you try to use Python . You is use should use Python ‘s build – in virtual environment 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.