Home Interests Python

How to Install pip on Mac, Windows, and Linux

howchoo
howchoo   (467)
August 23, 2023
6 minutes

Share

Interests
Posted in these interests:
code • 11 guides
python • 18 guides

The Python standard library includes a great set of modules, but many projects will require the use of third-party modules. Python modules are grouped into packages, so in order to use external modules, we’ll need to install the appropriate package. That’s where pip comes in.

What is pip?

Python packages are maintained in a central repository call PyPI (Python Package Index). It can be pronounced “pie pee eye” or “pie pie”, but not “pie pee” or “pee pee” or anything like that. Now, you could download packages directly from this repository yourself, but that would be a pain.

Pip stands for “pip installs packages”. It’s a command-line tool that allows you to install, upgrade, and uninstall Python packages.

In this guide, we’ll cover how to install pip for Python on all major platforms.

To instead learn how to install Python 3 on Windows 10, then check out our guide.

1 – Install pip on macOS

There are a few options to install pip on MacOS:

Option 1: Use Homebrew (recommended)

Install Homebrew

Homebrew is one of the better package managers for Mac. To install Homebrew, open Terminal and type:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Read more here.

Install pip using Homebrew

Using Homebrew to install python will install the latest Python (Python 3.7 currently), pip, and Setuptools.

brew install python

Option 2: Use easy_install

easy_install is the predecessor to pip, and it comes preinstalled on macOS (along with Python 2). You can use easy_install to install pip for Python 2.

sudo easy_install pip

2 – Install pip on Windows

Download the installer script

Right click on this installer script and select Save As….

Run the installer script

Open the Command Prompt, then navigate to the directory where you downloaded the script.

Now run:

python get-pip.py

3 – Install pip on Linux

The command to install pip on Linux will vary based on the distribution you’re using (and the package manager). Below I’ll list the common package managers.

APT (Advanced Packaging Tool)

Python 2.x

sudo apt-get install python-pip

Python 3.x

sudo apt-get install python3-pip

Pacman

Python 2.x

sudo pacman -S python2-pip

Python 3.x

sudo pacman -S python-pip

Yum

Python 2.x

sudo yum upgrade python-setuptools
sudo yum install python-pip python-wheel

Python 3.x

sudo yum install python3 python3-wheel

4 – Learn how to install Python packages using pip

Now that pip is installed, learn how to install Python packages using pip.

NEXT UP

Secure Your Sensitive Data with Kubernetes Secrets

Learn how to create and use Kubernetes secrets.
howchoo   (467)
November 26, 2023

Kubernetes secrets are objects that store and manage sensitive data inside your Kubernetes cluster. One mistake developers often make is storing sensitive information like database passwords, API credentials, etc in a settings file in their codebase. This is very bad practice (hopefully for obvious reasons). Most developers know this, but still choose the option because it’s easy.

Continue Reading

howchoo

 467 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Discover interesting things!

Explore Howchoo's most popular interests.

Explore