How to Install and Setup Python on Windows 10

how to install and setup python on windows 10
Liked the Article? Share it on Social media!

In this Python Beginner Tutorial, we will start with the basics of how to install and set up Python for Windows 10. We will also take a look at the interactive prompt of Python, as well as creating and running our first script. Let’s get started.

Prerequisites

  • Windows 10 computer
  • Command prompt (comes with windows by default)

Install Python on Windows 10

Installation of Python on the Windows 10 operating system is very straightforward. It’s just a matter of downloading the installer from Python website and running it on your windows computer.

First of all, we can check whether our computer has the python installed by running below command on the windows command line.

python

If you’re getting something similar to ‘python’ is not recognized as an internal or external command, operable program or batch file. Then that means python is not installed in your windows machine.

check python has installed on windows 10

Here is the step by step guide on how to install Python on Windows.

  1. Open your favourite web browser and go to the official python website. Then download the latest version of Python.
download latest version of python on windows 10

Note: Python website will automatically detect your operating system. Since I’m on a Windows Computer, it will prompt me to download the executable file.

  1. The downloaded executable file typically located in the Downloads folder.
default downloaded folder in windows 10
  1. Double click on the executable file. Installation Python will begin now. Select the default location for download.
  • Make sure to check the “Add Python 3.8 to Path” option. – so that you won’t need to add the path to the Windows System variables manually. The benefit is you can run python commands within the windows command line.
install python with path added to windows
  1. Within a few seconds, python will install in your windows computer.
python installation process
  1. After installation finished, then hit the close button.
installation is completed on windows 10
  1. To make sure our installation process completed, open up the windows command line and type below command.
python --version

If you get the python with its version, that means you’ve successfully installed the latest version of python on your windows machine.

check installed python version on windows

Working with Interactive prompt

All right, you have already install and setup the Python on your windows 10 computer. Let’s see how can we write some basic Python scripts.
When we installed Python, it gives us “interactive prompt”. To access it open up your command line and type python.

interactive prompt of python using windows command line

The interactive prompt allows us to write one line of python code at a time. For example:- we can print “hello world” to the console by just typing print('hello world') function.

using the python interactive prompt

This prompt is useful when we are testing Python commands, but in real-world applications, there are thousands of code lines in multiple python files. Such that each Python file contains multiple lines of codes.

To create such kind of Python script we need a text editor. When we downloaded the Python, it came with a default editor called “IDLE”.

Let’s open the IDLE application. Just search on the windows search bar to open the IDLE program. By default IDLE also an interactive prompt, meaning we can execute one line of code.

Working with the IDLE editor

To create a new file, go to File -> New File or use the shortcut keys of ctrl + N. Now we can code multiple lines of codes and form an executable Python script.

For example: – let’s print the Hello World to the console. For that use the print() function. Inside the parentheses add a string as ‘Hello World’.

Now let’s save the file which we have edited.

For that go to File -> Save or use the shortcut keys of ctrl + s. Then give it a valid name and location to be saved. Let’s run our script. Open up your windows command line and enter the python command with the name of the file we’ve saved. After executing the above command, our python script will run. “Hello, world” should be printed out to the console.

python run script of idle program

Even Though you could use default IDLE editor for writing python scripts, Most software professionals use some text editor or IDE.

Below are some of the best text editors and IDE’s for python application development.

  • VS code
  • Atom Text Editor
  • Sublime Text
  • PyCharm IDE

Conclusion

In this tutorial, you’ve learned about how to install and setup Python on Windows 10 computer. If you are using old versions of Windows, this guide might differ slightly but will apply most of the things I mentioned above. We also learn how to write your first python program using the command line and default python IDLE editor. Now you’ve set up python on your windows machine and ready to start writing some code.


Liked the Article? Share it on Social media!

1 thought on “How to Install and Setup Python on Windows 10”

Leave a Comment

Your email address will not be published.

Scroll to Top