TranslateProject/sources/tech/20230113.0 ⭐️ How to Install Python on Windows [Beginner’s Guide].md
2023-01-18 09:01:12 +08:00

5.7 KiB
Raw Blame History

How to Install Python on Windows [Beginners 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. Its 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 developers 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.

Download Python

How to locate Python set up

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.

Install Python step 1

Install Python step 2

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

Python version on Windows

You should see your systems 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.

Open Environment variable Settings

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.

Check Python Environment PATH Values in Windows

Create and run your first Python program

For an additional step, heres how you can code & run your first Python program. You should ideally use any recommended Python editor to write your program.

Heres 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:

Running a simple Python program in Windows

Closing Notes

I hope this simple beginners 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/

作者:Arindam 选题:lkxed 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出