W3docs

How to install PIL with pip on Mac OS?

To install PIL (Python Imaging Library) using pip on Mac OS, you can use the following command in your terminal:

To install PIL (Python Imaging Library) using pip on Mac OS, you can use the following command in your terminal:

install PIL

pip install pillow

This installs Pillow, the modern, actively maintained fork that replaces the deprecated PIL package.

Make sure you have Python installed on your Mac. macOS no longer ships with Python 3 by default, so you may need to install it first via the official installer or Homebrew (brew install python). Once Python is available, you can install or upgrade pip with:

install pip

python -m ensurepip --upgrade

You can also use this command to upgrade pip to the latest version if it is already installed.

Always run installation commands inside a virtual environment, or use the --user flag to avoid requiring admin access.