Introduction
Python is a popular high-level programming language that was first introduced in 1991. Python has grown in popularity since then, and it is now one of the most popular and adaptable server-side programming languages.
Unlike most Linux versions, Windows does not provide Python as a default programming language. Python, on the other hand, may be installed in just a few simple steps on your Windows server or local machine.
Prerequisites
- A Windows 10 system with administrative rights
- Use the Command Prompt (comes with Windows by default)
- An application for connecting to a remote desktop (use if you are installing Python on a remote Windows server)
Python 3 Installation on Windows
Why choose python 3
Python 3 is more popular and comes with a type system. The print function in Python 2 is outdated and uses an older syntax. While Python 2 is still used in DevOps for configuration management, Python 3 is now the industry standard.
Python (the programming language, not the snake) is a popular coding language for novices to learn. Python is a programming language that you may have heard of if you’re new to coding or changing careers. Python is promoted by programmers as a high-level language that is more productive than Java. Python is frequently taught first in university computer science courses because it is one of the easiest programming languages to learn.
Python is well-liked in the programming community because of its versatility. Despite its short lifespan, the open-source language has matured into a powerful, understandable tool for streamlining the web building process. Python has evolved through several versions, the most current of which being Python 2 and Python 3.
Select Version of Python to Install
The installation technique entails downloading and running the official Python.exe installer on your computer.
The version you require is determined by the Python task at hand. For example, if you’re working on a Python 2.6 project, you’ll almost certainly need that version. If you’re starting a project from the ground up, you have a lot of options.
We recommend that you download both the current versions of Python 2 and 3 if you are learning to develop in Python. You can use Python 2 to work on older projects or to test new ones for backward compatibility.
How to Install Python on Windows
There are three installation methods on Windows:
1 The Microsoft Store
2 The full installer
3 Windows Subsystem for Linux
You’ll learn how to check which version of Python is installed on your Windows machine in this section. You’ll also discover which of the three installation options is best for you.
What are your choices?
There are three ways to install the official Python distribution on Windows, as mentioned:
Microsoft Store package: On Windows, the most basic installation method is to use the Microsoft Store app. Beginner Python users searching for an easy-to-set-up interactive experience should try this
Full Installer: This method entails downloading Python from the Python.org website directly. This is for intermediate and advanced developers who need more control over the setup process.
The Windows Subsystem for Linux (WSL) allows you to run a Linux environment in a Windows environment. Read the Windows Subsystem for Linux Installation Guide for Windows 10 to learn how to enable the WSL.
Only the first two alternatives, which are the most common installation techniques in a Windows system, will be covered in this section.
If you want to install in the WSL, go to the Linux section of this article after installing your preferred Linux distribution.
Note:“Alternative distributions, such as Anaconda, can be used to complete the installation on Windows, but this tutorial only covers official distributions.
Anaconda is a well-known Python environment for data science and scientific computing. Setting Up Python for Machine Learning on Windows describes how to get Anaconda up and running on Windows.”
There are differences between the two official Python installers for Windows. There are some significant limits to the Microsoft Store bundle.
Limitations of the Microsoft Store Package
In the official Python documentation, the Microsoft Store package is described as follows:
The Microsoft Store package is a simple Python interpreter that is intended for interactive use, such as by students. (Source)
The most important point is that the Microsoft Store package is “primarily designed for interactive use.” That is to say, the Microsoft Store package is intended for students and people who are learning Python for the first time.
The Microsoft Store package has constraints that make it unsuitable for a professional development environment, in addition to being aimed towards novice Pythonistas. It doesn’t have full write access to shared folders like TEMP or the registry, for example.
Windows Installer Recommendations
You should install from the Microsoft Store package if you’re new to Python and want to study the language rather than build professional software. This is the quickest and easiest way to get started with the least amount of hassle.
If you’re a seasoned developer looking to work on commercial software in a Windows environment, the official Python.org installation is the way to go. You won’t be restricted by Microsoft Store constraints, and you’ll have complete discretion over where the executable is installed and whether or not Python is added to your PATH.
How to Install from the Microsoft Store
If you’re new to Python and want to get started quickly, the Microsoft Store package is the most convenient method to get started. Two steps are required to install through the Microsoft Store.
Firstly, Go to the Microsoft Store’s Python App Page.
Search for Python on the Microsoft Store app.
You’ll see that there are a few different versions to choose from:
The Microsoft Store’s “Python” search results
Select Python 3.8 or the highest version number available in the programme to open the installation screen.
Warning: “”Ascertain that the Python program you’ve chosen was created by the Python Software Foundation”
The official Microsoft Store bundle will always be free, therefore if an app costs money, it’s not the right software.”
You can also launch PowerShell and enter the following command:
“C:\> python”
If you don’t already have a version of Python installed, pressing Enter will take you to the Microsoft Store, where you may download the most recent version.
Then Install the Python App
After you’ve decided which version to install, continue the installation by following these steps:
Get started by pressing the Get button.
Ø Allow time for the app to download. When the download is complete, the Get button will be replaced by an Install on my devices button.
Ø Select the devices on which you’d like to complete the installation by clicking Install on my devices.
Ø To begin the installation, click Install Now and then OK.
Ø The notice “This product is installed” will appear at the top of the Microsoft Store page if the installation was successful.
Congratulations! Python, including pip and IDLE, is now available to you!
How to Install from the Full Installer
Installing via the complete installer is the best option for expert developers that require a full-featured Python programming environment. Installing via the Microsoft Store provides less customization and control over the installation.
In two steps, you can install from the full installer.
Firstly, Download the Full Installer
To get the full installer, follow these steps:
Navigate to the Python.org Downloads page for Windows in a browser window.
Click the link for the Latest Python 3 Release – Python 3.x.x under the “Python Releases for Windows” category. At the time of writing, Python 3.8.4 was the most recent version.
Select either the Windows x86-64 executable installer for 64-bit or the Windows x86 executable installer for 32-bit at the bottom of the page.
If you’re not sure whether to use the 32-bit or 64-bit installation, expand the box below for more information.
Continue to the next step once the installer has finished downloading.
And then Run the Installer
After you’ve selected and downloaded an installer, double-click on it to launch it. A dialogue window will popup
There are four things to keep in mind when looking at this dialogue box:
the default install path is in the current Windows user’s AppData/ directory.
The Select installation button allows you to customise the installation location as well as which additional features, such as pip and IDLE, are installed.
The Install launcher for all users (recommended) checkbox is checked by default. This means that all users on the machine will have access to the py.exe launcher. To limit Python to the current Windows user, uncheck this option.
by default, the Add Python 3.8 to PATH checkbox is unchecked. There are various reasons why you would not want Python on your PATH, so think about the consequences before checking this option.
You have complete control over the installation process with the full installer.
Warning:“It is strongly advised that you do not use the entire installation if you do not understand what PATH is. Instead, get the Microsoft Store bundle.”
Use the settings on the dialogue box to customise the installation to match your needs. Then press the Install Now button. It’s as simple as that!
Verify Pip Was Installed
It’s likely that if you installed an older version of Python, it didn’t come with Pip preinstalled. Pip is a robust software package management system for Python. As a result, double-check that it’s installed.
For most Python packages, we recommend Pip, especially when working in virtual environments.
To check if Pip is installed, run the following commands:
In the Start menu, type “cmd.”
Select the Command Prompt application.
Type pip -V in the console. If Pip was installed properly,
If you obtain the following output, Pip is not yet installed:
‘pip’ is not recognized as an internal or external command,Operable program or batch file.
Add Python Path to Environment Variables (Optional)
If your Python installer version does not feature the Add Python to PATH checkbox or if you have not selected that option, we recommend you go through this step.
The Python path to system variables can be set up to eliminate the requirement for entire paths. It tells Windows to search all of the PATH folders for the word “python” and then go to the install folder to find the python.exe file.
1. Launch the Run app from the Start menu.dialogue box to run
2. Click OK after typing sysdm.cpl. This brings up the System Properties dialogue box.
3. Select Environment Variables from the Advanced tab on the Advanced screen.
4. Locate and pick the Path variable under System Variables.
5. Select Edit from the menu.
6. Go to the Variable value field and choose it. Add a semicolon before the path to the python.exe file (;). We’ve added “;C:Python34” to the image below, for example.
7. Close all windows by clicking OK.
You can run Python scripts like this after putting this up: script.py is a Python script.
C:/Python34/Python script.py should be used instead.
It is cleaner and more controllable, as you can see.
Install virtualnv (Optional)
Python is installed, and Pip is used to manage packages. You’ll need one more piece of software now: virtualnv. For your Python projects, Virtualnv allows you to construct isolated local virtual environments.
Why should you utilisevirtualnv?
By default, Python software packages are installed throughout the entire system. As a result, any modification to a single project-specific package affects all of your Python projects. You’d prefer to avoid this, and the simplest way to do so is to create different virtual environments for each project.
To set up virtualnv, follow these steps.
1. Type “cmd” into the Start menu.
2. Open the Command Prompt programme.
3. In the console, type the following pip command:
pip install virtualenvC:UsersUsername>
Conclusion
We covered how to install Python 3.7.3 on Windows in this tutorial. You should expect a similar procedure if you’re installing a different version of Python.
Check out our article on how to upgrade Python to 3.9 for more information.
Remember to pick your version wisely, install Pip, and use virtual environments while working on numerous projects on the same computer.
Do you want to test out another server-side scripting language from the new generation? See How to Install Ruby on Windows 10 for more information.