
In this post, you will learn how to download and install Python on windows and run a python file on windows.
Installing Python –
There are various way to install python on windows. Let’s look at them one by one.
Method 1 – Install Python from the official website
The first method is downloading python from the official python website. If you just want to install python and comfortable in installing and managing packages manually based on your need then you should follow this option.
To Install –
Step 1 – First visit the python website – https://www.python.org/downloads/ and click on download. This will download an .exe file for installation.

Step 2 – Double click the .exe file and check Add python 3.x to PATH. Then click on Install Now.

Follow the process as suggested to finish the installation. This should install python on your machine.
Method 2 – Install Python from Anaconda –
Anaconda is a distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment.
You should use this method if you are new to programming and don’t want to go through all the hassle of stetting up python yourself.
Step 1 – First go to the Anaconda website – https://www.anaconda.com/ and click on download. This will download an .exe file.

Step 2 – Double click on the .exe file to open the installer.Then click Next and accept the license Agreement

Step 3 – Then select just me and Let the default directory to install as it is. Just click on Next.

Step 4 – Select both the options and click Install.

Running Python Code –
There are also several ways to run python code. Let’s look at them One by One.
Method 1 – Using Jupyter Notebook
If you installed Python using Method 2 then you already have jupyter notebook installed. But if you have installed Python using Method 1 then type the following in command prompt or powershell to install jupyter notebook
pip install notebook
Next, launch jupyter notebook by typing the following command in powershell.
jupyter notebook
This will open the jupyter notebook in your default web browser.

Now click on New and select python 3 to open a notebook. Then type the following code
print("hello, World!")
And then press Shift + Enter to run this code.
Method 2 – Using Python IDE –
There are various IDE to run python code but vscode is very simple and widely used for python. So we will use that.
Step 1 – Go to this website – https://code.visualstudio.com/ and download the .exe file.

Then follow the normal process to install any software on windows.
Step 2 – Open vscode and install the python extension made by microsoft. The installing extension widget is on the left which looks like a window icon.

Step 3 – Now click on file at the top left in vscode and click on new file. Then type the following code
print("hello, world!")
And save this file with name test.py inside the Documents. You can save it anywhere but for illustration save it inside Documents.
Step 4 – Next open command prompt or powershell and navigate to the Documents directory.
cd Documents
Then type
python test.py
or
python3 test.py
and hit enter to run the python file.