At present, Python is among the most popular general-purpose programming languages. It was released for the first time in 1991, and the credit for its design goes to Guido van Rossum. It has always been a favourite of many hobbyists and qualified developers alike, owing to a design concept that stresses readability. Not only is it a surprisingly easy language to understand, but there are several projects available online that require Python to be enabled to use the program.
If you plan to learn or use Python on your Window Machine, you need to know that it doesn’t come pre-installed in Windows. It means that you need to install Python manually on your system, and this article is intended to help you with that. So, without further ado, let’s get started.
How to download and install Python 3?
How do I install Python 3? If you are looking for an answer to this question, you are at the right place. We will discuss all the necessary steps to help you download and run Python on Windows, Linux, and macOS. The Python version we are going to install is 3.7.4, which we can refer to as Python 3.
Note: The version keeps on updating, and you can try with same steps with minor changes whenever you try downloading the latest version.
Before learning how to install Python on your system, you must first understand what Python is. Here are some key points about Python that you need to know:
- Python is open-source, and all its versions are compliant with the GNU General Public License.
- We can install any version of Python from the Python Software Foundation's official website, python.org.
- Many operating systems, including Windows and Linux, support package managers that allow you to install Python directly on your system.
Python Installation and Setup
How to install Python on Windows
Python must be installed and manually configured since Windows does not come with it preinstalled. We'll show you how to install Python by following some simple steps that are discussed below:
- Download Python for Windows (latest version) from python.org.
- The first and most important step is to open a window and go to the website. https://www.python.org/downloads/windows/
- New Python 3 Beta – Python 3.7.4 is found under the Python Releases for Windows (Python download).
- Go to Files and choose Windows x86-64 executable installer for 64-bit or Windows x86 executable installer for 32-bit on this link.
Install Python Windows (version 3.7.4) on your system
- Run the Python Windows Installer from the downloads folder.
- Check the ‘Add Python 3.7 to Route’ option; you’ll have to do it manually. After that, click on the ‘Install Now’ option, and it will initiate the installation of Python.
- When the installation is complete, press the Close button.
How to install Python Linux (all distributions)
On every Linux distribution, like Ubuntu, Linux, Mint, Debian, OpenSUSE, CentOS, Fedora, and Arch Linux, installing Python is the same.
Run and execute the commands below to install Python on your Linux computer (for example, install python Ubuntu). Before that, you should run the following command in the terminal app to check if Python is already installed.
$ python --version
- To check the latest version of python 2.x.x, run the following command :
$ python2 --version
- To check the latest version of python 3.x.x, run the following command
$ python3 --version
It will likely not be the most recent version of Python. Python can be installed on a Linux distribution in a variety of ways.
The following commands will help to install Python on almost every major Linux distribution:
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.7
Python can also be downloaded and installed on a Linux distribution using another method.
Follow the steps below to update Python's new version from the source code.
- Download the latest version of Python from python.org.
- The first step is to open your browser and visit the website https://www.python.org/downloads/source/
- Download Gzipped root tarball, located under the Stable Releases (the latest stable release as of now is Python 3.7.4).
Run a single command below in the terminal to accomplish all of the preceding steps.
$ wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
Python 3.7.4 (latest version) can be installed on Linux
Enter the following command to get the prerequisites and other source files for successfully installing Python on Linux.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
We can now unravel the Python package we downloaded from the website earlier.
Using cd downloads in the terminal app and navigate to the downloads directory, and run the commands mentioned below:
$ tar xvf Python-3.6.5.tgz
$ cd Python-3.6.5
$ ./configure --enable-optimizations --with-ensurepip=install
$ make -j 8
$ sudo make altinstall
Finally, the most recent version of Python will be installed on your Linux system. You can execute the following command to validate if Python is installed successfully and get the information about the Python version:
How to install Python on macOS
Python is pre-installed on macOS, just like Linux. It may be Python 2 or some other outdated version. We'll use the Homebrew package manager to upgrade to the new version. It's one of the most efficient and easy ways to install and update Python on macOS.
Download and Install Homebrew Package Manager
Follow the instructions below to install and activate the Homebrew package manager on your macOS device.
- From Mac's Application -> utility menu, choose Terminal. The Bash terminal will open, allowing you to type commands.
- In the terminal, type and execute the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- If asked, type in the machine passcode, and it will load the Homebrew package manager.
- After that, you can see a message that says "Installation Effective." You're all set to use the Homebrew package manager.
Installing Python on macOS
Simply open the Terminal app from Application -> Utilities and type the following command to install the latest version of Python 3:
brew install python3
Python version 3 will be installed and enabled on your Mac; wait until the command processing is completed.
In your Terminal app, run the following commands to validate the installation.
Finally, Python 3 is installed successfully on your macOS system.
Pythion is a highly popular high-level programming language used for development purposes. This guide has shown how to install Python 3 on various operating systems like Windows, macOS, and Linux. It is the guide that will help you to install python3 on these three operating systems.
People also read: