Before writing and executing Python programs, you need to install Python on your computer. Python is available for Windows, macOS, and Linux.
Python can run on most modern computers. Before installation, make sure your operating system is supported and that you have permission to install software on your computer.
Python can be downloaded from the official Python website.
Visit the Python website and open the download section. Select the appropriate installer for your operating system.
Follow these steps to install Python on Windows.
When installing Python on Windows, you may see an option to add Python to the system PATH.
Enabling this option makes it easier to run Python from the Command Prompt or PowerShell.
After installation, you can check whether Python is available from the terminal.
Open Command Prompt or PowerShell and type the following command:
You can also try:
If Python is installed correctly, the command will display the installed Python 3 version.
The exact version number may be different depending on the version installed on your computer.
Python 3 can be installed on macOS using the official Python installer or another trusted package-management method.
After installation, open Terminal and check the Python version.
Many Linux distributions provide Python 3 through their package manager. The exact installation command depends on the Linux distribution.
For example, on Debian or Ubuntu-based systems, Python 3 can commonly be installed using the system package manager.
After installation, check the version:
After installing Python, you can open the Python interactive interpreter from the terminal.
On many systems, use:
or:
You will see a prompt similar to:
You can now enter Python commands directly.
You can create a simple Python file to verify that Python is working correctly.
Open the terminal in the folder containing the file and run:
On systems where Python 3 is invoked using python3, use:
pip is the package installer commonly used to install Python packages from the Python Package Index (PyPI).
You can check whether pip is available using:
On some systems, you may use:
The command displays the installed pip version and related information.
If you need to remove Python, use the normal software management tools provided by your operating system.
If the terminal cannot find Python, check whether Python was added to PATH or use the appropriate Python command for your operating system.
Check the installed version using:
Try checking pip with:
If multiple Python versions are installed, make sure you know which interpreter your project is using.
After installing Python, you can choose a code editor or integrated development environment (IDE) for writing programs.
Beginners can start with IDLE or Visual Studio Code. As you progress, you can explore other development environments.
Which command can be used to check the installed Python version on Windows?