How to install Python and pip on windows, linux and macOS

Install Python

Here’s how you can install Python on different operating systems:

Windows
  1. Go to the official Python website (https://www.python.org/downloads/windows/) and download the latest version of Python for Windows.
  2. Run the installer and follow the on-screen instructions to install Python.
  3. After the installation is complete, open the Command Prompt and type “python” to start the Python interpreter.
Linux
  1. Most Linux distributions come with Python pre-installed. You can check if Python is already installed by opening a terminal and typing “python3”.
  2. If Python is not installed, you can use the package manager for your Linux distribution to install it. For example, if you’re using Ubuntu, you can use the following command to install Python: “sudo apt-get install python3”.
  3. After the installation is complete, open a terminal and type “python3” to start the Python interpreter.
macOS
  1. Go to the official Python website (https://www.python.org/downloads/mac-osx/) and download the latest version of Python for macOS.
  2. Run the installer and follow the on-screen instructions to install Python.
  3. After the installation is complete, open the Terminal and type “python3” to start the Python interpreter.

Note that on Linux and macOS, you may need to use “python3” instead of just “python” to start the Python interpreter, as some systems may have both Python 2 and Python 3 installed.

Install pip package manager

Pip is a package manager for Python that makes it easy to install and manage packages (libraries and tools) for your Python projects. Here’s how you can install pip on different operating systems:

Windows
  1. Python 3.4 or later versions come with pip pre-installed, so you don’t need to install it manually. You can check if pip is already installed by opening the Command Prompt and typing “pip –version”.
  2. If pip is not installed, you can download the get-pip.py script from https://pip.pypa.io/en/stable/installation/.
  3. Open the Command Prompt and navigate to the directory where you have saved the get-pip.py script.
  4. Run the following command to install pip: “python get-pip.py”.
Linux
  1. Most Linux distributions come with pip pre-installed for Python 3. You can check if pip is already installed by opening a terminal and typing “pip3 –version”.
  2. If pip is not installed, you can use the package manager for your Linux distribution to install it. For example, if you’re using Ubuntu, you can use the following command to install pip for Python 3: “sudo apt-get install python3-pip”.
macOS
  1. Python 3.4 or later versions come with pip pre-installed, so you don’t need to install it manually. You can check if pip is already installed by opening the Terminal and typing “pip3 –version”.
  2. If pip is not installed, you can use the Homebrew package manager to install it. First, install Homebrew by following the instructions on their website (https://brew.sh/). Then, run the following command to install pip: “brew install python”.

After installing pip, you can use it to install packages for your Python projects. For example, to install the NumPy package, you can run the following command: “pip install numpy”.