Windows is by far the most popular operating system used among every class of people including Gamers, Students and every possible other fields that you can think of.
Python is a crucial skill to learn in this decade. But for absolute beginners setting up a python environment in a windows might be confusing and frustrating.
Though there are many tutorials online, Still some beginners find it difficult to follow through, So I have decided to make it simple and detailed as possible.
Note: This is a beginner friendly tutorial if you already have experience installing windows software feel free to skip to the part that you require.
Let’s Get Started
Downloading Python
Python can be downloaded from their official website https://www.python.org or directly from the Microsoft store(just search for python in Microsoft store and click on Get)
I highly recommend downloading from their website even though it takes some extra steps.
when we visit the python page it looks something like this
If you hover over the button Downloads button you will see this
Clicking on Python 3.8.1 button will download the 32-bit version of the python. But we need the 64-bit version since modern computers use 64-bit processors which are more efficient. So installing the 64-bit version is the best choice. (If you are curious, look up the difference between 32-bit and 64-bit processors online and come back to this journey).
Click the windows button to see full downloads list.
It will redirect you to the following page.
We are going to focus on the Stable Releases area of the page. Note that there are various types of installers available. The one that we are interested is Windows x86–64 executable installer
Once you click the link it starts downloading. Wait for it to download and once it has been downloaded open the executable file.
You will be prompted with this window
Do not change any default settings unless you know what you are doing.
**Note that this is the path where the python is installed, This is very important for later Environment variables section.**
We will go through the various options later. For now just follow the steps.
Click on Install Now and you will be prompted by windows to allow or not. Click Yes wait for it to install and when done just close the window.
To verify whether it has been properly installed or not, search for python in your start menu(click on windows logo in the bottom left corner of your screen and start typing “Python”).
if you are able to see python 3.x 64-bit based on your version,(x represents your version) then you have done it properly. If not go back to previous steps and make sure you have installed it properly.
Adding Python to Path
Now that we have installed python. Its important to add to the path so that windows recognizes it anywhere with your system.
What does that mean. Let us demonstrate and experience that.(These steps are optional)
Open Command Prompt
If you don’t know how to open command prompt then click on the start button(windows logo) that we discussed earlier and search for command prompt or cmd for short.
If you open the Command Prompt App you will be looking at this
Go to the command prompt and type “python” without quotes and hit enter key.
So what’s wrong here? we have installed python but the command Prompt says we don’t have it.
The problem is windows doesn’t know where to look for python. So we must say to Windows “Look Here” to the python directory in order for it to recognize. These Look Here locations are called Environment Variables
Adding Python to Environment Variables
If you have made it so far well done, There are still some more steps for us to follow, hold it together.
Open Edit environment variables by searching in start menu
The system properties window will open
Once you click on Environment Variables a new window will pop up
Look for the System variables and find the Path variable. double click on it to edit.
The Edit Environment variables window will open up
These are the variables that windows looks for. Now to add python to that, we need to know the python’s path first. During installation we have noted installation path, now we have to add that path here.
Click on New
and enter the path of the python.exe folder
If you direct to that folder you will look something like this
Also add the Scripts folder to the path in order to use the pip packages
Finally your Edit environment prompt will look like this
Click OK button to save the changes
Now that we have added python to our path, go back to command prompt and enter “python” again
This time we will look something like this
Which means we have successfully installed python and added it to our environment variable. now we are done.👍👍