5.7 KiB
How to Install Python on Windows [Beginner’s Guide]
This simple guide demonstrates how to download and install Python on Windows.
This article is tested with the latest Python 3.11 stable version.
Before you learn how to install Python on Windows, you might want to check how you can install it easily on Linux distributions such as Ubuntu. It’s better to try Python in Linux if you are planning to be a developer. That being said, you might want to check how to install Linux (such as Ubuntu) alongside Windows.
Python is a popular general-purpose programming language which becomes the developer’s choice in the past decade. And its popularity is increasing every day. it is widely used for web development, complex systems, data science, machine learning and all areas of science.
There are two versions of Python that you may come across. Python2 is currently out of support. And the Python3 series is the ongoing support release.
Check whether Python is installed
Before you install it on Windows, you should check whether it is already installed. In general, it should not be installed, unlike in Ubuntu (and other Linux distributions), where Python comes pre-installed.
From the start menu, open “command prompt”.
And type the following:
python --version
If Python is available, it will show you a message with the version details.
Download and Install Python
Open the below official Python download page.
At the top, you should see the current stable version. Click on the download link. If you are looking for any specific version, scroll down on this page and download the specific version under the label “Python releases by version number:”.
After downloading, go to the Downloads folder and run the setup.
Follow the on-screen instructions to install it.
After installation is complete, verify the Python version.
Verify Python Version
From the start menu, open “command prompt” and run the following command.
python --version
You should see your system’s currently installed version of the Python package. Alternatively, you can also run below to get a Python interactive shell.
python
You can exit the shell using CTRL+Z and Enter.
Check PATH Variables
You should check the system variable PATH with the Python executable location. This should be updated automatically using the installer.
From the start menu, search “system variables” and open it.
In the System Properties Dialog, click on Advanced > Environment Variables
. Under the user variables section against the Path variable, check whether the Python installed location is present. Refer to the below image for a guideline.
If you see all the path is present, you are all set to run your Python project.
Create and run your first Python program
For an additional step, here’s how you can code & run your first Python program. You should ideally use any recommended Python editor to write your program.
Here’s a simple program which outputs the text “debugpoint.com” in the console.
# Sample Python program
print("debugpoint.com")
Save the file with any name. Here I have saved it as “hello.py” in E drive. The .py is the extension of Python source codes.
To run this program, open a command prompt and execute below inside E drive.
python hello.py
Output:
Closing Notes
I hope this simple beginner’s guide helps you to install Python in Windows, verify the installation and run your first program.
Please let me know if you run into issues in the comment box below.
Next:Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)
Using Mastodon? Follow us at floss.social/@debugpoint
via: https://www.debugpoint.com/install-python-windows/