Hackerzhome

hackerzhome-logo-bg

Install python on Windows, Linux, and Mac easily in 2 minutes

thumbnail- install python

Introduction:

 Python is one of the most popular and widely used high-level interpreted languages known for its ease of use and readability. Python is available for Windows, Linux, and macOS, making it a versatile tool for any computer user, But most people get confused and stuck when it comes to installation. So, In this article, we will show you how to install Python on Windows, Linux, and macOS. We will also show you how to configure your development environment and start writing your first Python code.

How to Install Python on windows:

Way 1: Installing it manually

  •  Head to the official website of Python (python.org/download) and download the latest version for windows.
  • After downloading, open the executable (.exe) file. It will take us to the python installation setup.
  • On the installation setup, Check the box “Add python.exe to PATH” and Choose “customize installation.”

install python on windows 1
  • On the optional feature tab, all the checkboxes are checked by default. If not, then Check all the boxes and click next.
  • On the Advanced options, Check the first box, “Install python for all users,” customize the installation path as you like, and then click on the install button.

install python on windows 2

That’s it. We have successfully installed Python’s latest version on our windows operating system.

 Way 2: Install Python from the Microsoft Store

The Microsoft Store is the best place to get Python if you’re a beginner. It’s quick and easy to install, and you don’t need to set up any external tools.

To install Python from the Microsoft Store:

  1. Open the Microsoft Store and search for “Python.”
  2. Click on the Python 3. x (Make sure to download the latest version) app.
  3. Click Install.

That’s it. Once the installation is complete, you can launch Python from the Start menu.

Using Python on command prompt:

Yes, We have installed Python on our windows machine. Let’s open it via the command prompt to check whether it is working properly and to write our first code.

  1. To open the command prompt, press the win key + R, type “cmd,” and then press “enter key” or click the start menu and search for “command prompt.” 
  2. To check the version, type the command ‘python –version.’
  3. To open the python interpreter and type our first code, type ‘python’ on the command prompt.
  4. Hooray! We have successfully opened our python interpreter. Now it’s time to code; type your desired code.

using python on cmd

Using python IDLE Shell:

IDLE stands for Integrated Development and Learning Environment. This IDLE shell comes default with python installation so that we can type and run our code here. Now, let’s see how to open the python IDLE shell and write our code.

  1. To open the python IDLE shell, click the start menu and type “IDLE.” 
  2. That’s it. We are good to go. Type your first code.

python on idle

So far, we have been using the single-line python interpreter(i.e., we can’t type more than 1 line). To type a whole program/script, Click on the file -> New.

Doing this will open up a new file for us to type. Our playground is now ready! Write the script, save and run it. 

How to Install Python on Linux

There are different ways to install Python on Linux. The most common way is to use a package manager such as apt-get, yum, etc. Alternatively, you can download the Python source code and install it manually.

Way 1: Installing Python using a package manager

You can install Python using your package manager with the help of these commands. 

On Debian-based distributions such as Ubuntu, you can use the apt package manager to install Python 3 like this: 

  • sudo apt-get install python3

On Fedora, you can use the dnf package manager to install Python 3 like this: 

  • sudo dnf install python3

On Red Hat, you can use the yum package manager to install Python 3 like this: 

  • sudo yum install python3

On SUSE, you can use the zypper package manager to install Python 3 like this: 

  • sudo zypper install python3

Way 2: Installing Python manually on Linux

The first thing you need to do is download the Python installer from the Python website. Be sure to choose the Operating system Linux and the installer for Python 3. x, as Python 2. x has reached end-of-life and is no longer supported.

Once the download is complete, open a terminal and navigate to the directory where you downloaded the installer. Then, run the following command:

  • sudo sh Python-3.x.x.tgz (Here, x.x refers to the version number)

This command will extract the files from the installer and install them on your system.

How to Install Python on Mac

macOS comes with Python 2.7 installed by default. However, this version is outdated and no longer supported by the Python community. Therefore, we will install Python 3. 

There are two ways to install Python 3 on your Mac. Like Linux, you can use a package manager such as Homebrew to install Python 3 or manually download and install it from the python website. 

Way 1: Using package manager

Here is the command to install Python using the homebrew package manager,

  • brew install python3

The installation process will take a few minutes to complete.

If you don’t have Homebrew installed on your Mac, install Homebrew first and then use it to install Python 3.

Verifying the Installation:

Once the installation is complete, you can verify it by entering the following command:

  • python3 --version

This command should return the version of Python installed, such as Python 3.11.1. 

If you see an error message instead of the Python version number, Python is not correctly installed. In this case, try uninstalling and then reinstalling Python using Homebrew.

Way 2: Installing Python 3 from the Python Website

Visit the Python downloads page and download the macOS installer’s latest version of Python 3, which at the time of posting this article is 3.11.1.

Once the download is complete, open the file and follow the on-screen instructions to install Python 3 on your computer.

After the installation, we can test that Python is working properly by opening up the Terminal application and typing “python3”. This command should bring up the Python interpreter, and we can then type in some code to ensure everything is working.

Conclusion

This blog post has shown how to install Python on three different platforms: Windows, Linux, and Mac OS. Each platform has its own set of instructions, so be sure to follow the steps for your specific system. Once Python is installed, you can start using it to develop programs and scripts.

Make sure to comment below if you face any difficulties downloading Python; we will try to help you. Subscribe to our newsletter to receive a notification whenever we add a new blog post. See you all in the following article. Cheers!

Share this post
WhatsApp
Telegram
Facebook
Twitter
LinkedIn
Cyberghost

Cyberghost

A Computer science Engineer, Certified Ethical hacker (CEH), Offensive Security Certified professional (OSCP), SOC Analyst & Content Creator.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Our Community

Table of Contents

weekly trending

SUBSCRIBE VIA EMAIL

Post Tags
Related Articles