Python is a powerful and dynamic language. To begin Python programming, you must have Python programming language installed on your computer. You can install it on the most available operating systems such as Windows, Linux, Unix, macOS, etc. There are various methods of installing Python on different operating systems.
Installing Python on Windows
In Windows, you can install Python in two different ways:
Download Python from the Microsoft Store
To download Python binary language from the Microsoft Store, follow these steps:-
- Open Command Prompt, type python in it, and press the enter key.
- A Microsoft Store window will automatically prompt and redirect you to the Python store page.
- Just press the install button.
- Once the Python installation is complete, go to the start menu, and you can find Python in the installed applications list.
Download Python from the Python.org
To install the Python binary language from the official website Python.org, follow these steps:-
- Open the link https://www.python.org/downloads/windows/ and download Python's latest release.
- It will take you to a web page containing all the new features added in that particular python version. Download the Python installer files by scrolling down to the end of the page.
- Download Python, Windows installer (32-bit) or Windows installer (64-bit) as per your system's requirement
- After downloading Python, click on the Python installation file.
- A setup wizard will pop up. Check the 'Add Python to PATH' checkbox and then Install now.
- After installation, click on finish. Check your start menu to find Python in the installed applications list.
To check whether Python installation is successful on Windows, Open the command prompt, type, and run the following command.
Open your favorite text editor to write your first Python program, write any Python code, and don't forget to save it with the '.py' extension. You can run the script by typing the command in the command prompt.
Download Python on macOS
You can download Python on macOS from the Official Python Website. Follow these steps:-
- Open the Python download link https://www.python.org/downloads/macos/ and go to the latest python release link.
- It will redirect you to a web page containing all the new features added in that particular python version. At the end of the page, you will find the installer files.
- Click on the macOS 64-bit universal2 installer.
- The Python download will start. After downloading, open it.
- A Python setup wizard will pop up. Check the 'Add Python to PATH' checkbox and then Install now.
- After installation, click on finish. Check your start, and you can find Python in the installed applications list.
For Linux Users
Almost all Linux distributions come with Python pre-installed except for some distribution. Check and upgrade to the latest version. There are a number of package managers available to install the software on Linux. Use a package manager to install Python. Open the console and type the given command to check the installed version.
$ python3 –version
If the latest version or release is already installed in the system, then do need to update, else update or install the newest version by using the given commands on Debian or Ubuntu.
To check if Python3 is available for installation.
$ sudo add-apt-repository ppa:deadsnakes/ppa
Update the environment with the following command.
$ sudo apt update
Now you can install using the command.
$ sudo apt install python3
On Centos distribution, use the following commands:
$ yum update -y
$ yum install -y python3
For Arch Based Distros, use the following commands:
$ yum update -y
$ sudo pacman -Syu python3
For Fedora Based Distros, use the following commands:
$ yum update -y
$ sudo dnf install Python
Run an interactive python shell using the given command in the Terminal
Python code can be run by typing the following command in the Terminal