Python Installation
Before writing Python programs, we need to install Python on our computer. In this section, we will learn how to download Python, install it on Windows, and verify that the installation is working correctly.
What You Will Learn
- How to download Python
- How to install Python on Windows
- How to configure Python during installation
- How to verify Python installation
- How to check the installed Python version
Step 1: Download Python
Python can be downloaded from the official Python website. Always prefer the official Python website when installing Python.
https://www.python.org/
Step 2: Choose the Python Version
On the Python website, download the latest stable Python 3 release available for your operating system.
For this tutorial, we will use Python 3. Python 2 is an older version and is no longer used for modern application development.
Step 3: Start the Installation
After downloading the Python installer, open the installer file to start the installation process.
On Windows, make sure you select the option "Add Python to PATH" before clicking Install.
Installation Flow
- Download the Python installer.
- Open the installer.
- Select Add Python to PATH.
- Click Install Now.
- Wait for the installation to complete.
- Close the installer after successful installation.
Step 4: Verify Python Installation
After installation, we can verify Python using Command Prompt.
Open Command Prompt and run:
python --version
Example Output
Python 3.x.x
The exact version number may be different depending on the Python version installed on your computer.
Using the Python Command
We can also start the Python interactive interpreter by typing:
python
If Python is installed correctly, you should see the Python prompt:
>>>
Test Your Python Installation
Now let's execute a simple Python statement.
print("Python is working!")
Output
Python is working!
What is PATH?
PATH is an environment variable used by the operating system to locate executable programs.
When Python is added to PATH, we can run the python command directly from Command Prompt or PowerShell.
Common Problem
If the command python --version does not work, Python may not have been added to PATH correctly.
Python Launcher on Windows
On Windows, you can also try the Python launcher:
py --version
If Python is installed and the Python launcher is available, this command displays the installed Python version.
CIIT Learning Point
Always verify your Python installation before starting development. Knowing how to check the Python version and run a basic command will help you troubleshoot environment-related problems.
Summary :
Python is a powerful, high-level and versatile programming language. Installing Python correctly, configuring the PATH environment variable, and verifying the installation provides the foundation for starting Python development.