Featured Article

"Master Python Pillow Installation: Step-by-Step Guide"

Christopher Jun 29, 2026

Installing Python Pillow: A Comprehensive Guide

Image Processing Library
Image Processing Library

Python's Pillow library, a fork of the Python Imaging Library (PIL), is a powerful tool for processing and manipulating images. It provides a wide range of image processing features, making it an essential library for any Python developer working with images. In this guide, we'll walk you through the process of installing Pillow in a step-by-step manner, ensuring you have the library ready to use in your Python projects.

a large blue sculpture sitting in the middle of a field next to bushes and trees
a large blue sculpture sitting in the middle of a field next to bushes and trees

Prerequisites

Before we begin, ensure you have the following prerequisites installed on your system:

Tutorial
Tutorial
  • Python (3.5 or later)
  • pip (Python's package installer, comes bundled with Python)

Installing Pillow via pip

Turquoise Python Print Throw Pillow: Double-Sided Accent Pillow
Turquoise Python Print Throw Pillow: Double-Sided Accent Pillow

The recommended way to install Pillow is using pip, Python's package installer. Here's how you can do it:

  1. Open your terminal or command prompt.

  • Type the following command and press Enter:

  • Creative Design Living Room Sofas Accent Luxury Interior Fashion Save Space Living Room Sofas
    Creative Design Living Room Sofas Accent Luxury Interior Fashion Save Space Living Room Sofas

    pip install pillow
  • pip will download and install Pillow along with its dependencies. You'll see output similar to this:

  • Collecting pillow
      Downloading Pillow-8.4.0-cp38-cp38-manylinux_2_17_x86_64.whl (32.1 MB)
         |████████████████████████████████| 32.1 MB 1.5 MB/s
    Installing collected packages: pillow
    Successfully installed pillow-8.4.0

    Verifying the Installation

    Maximalist dusty pink olive tiger print art deco terracotta striped headboard
    Maximalist dusty pink olive tiger print art deco terracotta striped headboard

    To verify that Pillow has been installed correctly, open a Python shell or script and import the library:

    from PIL import Image
    
    print(Image.__version__)
    

    The script should print the installed version of Pillow, confirming that the library has been successfully installed.

    100% Shearling Oversized Pillows
    100% Shearling Oversized Pillows
    a pyramid with the words python library and frameworks on it, in front of a white
    a pyramid with the words python library and frameworks on it, in front of a white
    a glass vase sitting on top of a wooden table next to a black tray filled with water
    a glass vase sitting on top of a wooden table next to a black tray filled with water
    Noir | Crocodile Embossed Decorative Pillow
    Noir | Crocodile Embossed Decorative Pillow
    Snake Pillow Case | Python Snake Throw Pillow Cover | Luxe Reptile Decor
    Snake Pillow Case | Python Snake Throw Pillow Cover | Luxe Reptile Decor
    a bed with green and white pillows on it
    a bed with green and white pillows on it
    a brown pillow sitting on top of a white rug
    a brown pillow sitting on top of a white rug
    Naida
    Naida
    Square Velvet Pillow Cover & Insert 22.0 H x 22.0 W x 4.0 D in gray/yellow/brownDown / Feather/Velvet/Textured
    Square Velvet Pillow Cover & Insert 22.0 H x 22.0 W x 4.0 D in gray/yellow/brownDown / Feather/Velvet/Textured
    Genuine Axis Pillows W/ Black Stripe Brown Leather Backing. Comes With Insert - Etsy
    Genuine Axis Pillows W/ Black Stripe Brown Leather Backing. Comes With Insert - Etsy
    Patchwork Snake Pillow Cover - Printed From Original Textile Art, Accent Pillow for Sofa or Chair, Home Decor Statement Piece
    Patchwork Snake Pillow Cover - Printed From Original Textile Art, Accent Pillow for Sofa or Chair, Home Decor Statement Piece
    an image of a snake's head with arrows pointing to the front and side
    an image of a snake's head with arrows pointing to the front and side
    How To Install and Run Python 3.6/3.9 in Termux (Latest Guide)
    How To Install and Run Python 3.6/3.9 in Termux (Latest Guide)
    Handmade Snake Pillow Plush
    Handmade Snake Pillow Plush
    My cousins ball python:3
    My cousins ball python:3
    Understanding Python encapsulation concepts
    Understanding Python encapsulation concepts
    diagram of a ball pit tank enclosure with plants and other parts labeled in red text
    diagram of a ball pit tank enclosure with plants and other parts labeled in red text
    Aurielle Jones: Redefining Luxury Pillows in Atlanta
    Aurielle Jones: Redefining Luxury Pillows in Atlanta
    Installing Python on Windows
    Installing Python on Windows
    a giraffe print pillow sitting on top of a white couch
    a giraffe print pillow sitting on top of a white couch

    Troubleshooting Common Issues

    While installing Pillow, you might encounter some common issues. Here's how you can troubleshoot them:

    Issue Solution
    Error: "No module named 'PIL'" You might be using an older version of Python. Upgrade to Python 3.5 or later, and try installing Pillow again.
    Error: "Cannot install Pillow, requires C++ compiler" Pillow requires a C++ compiler to build from source. If you're using a Linux distribution, install a C++ compiler using your package manager (e.g., `sudo apt-get install build-essential` for Ubuntu).

    Using Pillow in Your Projects

    Now that you have Pillow installed, you can start using it in your Python projects. Here's a simple example of opening and displaying an image using Pillow:

    from PIL import Image
    import sys
    
    try:
        img = Image.open('example.jpg')
    except FileNotFoundError:
        print("File not found")
        sys.exit(1)
    
    img.show()
    

    This script opens the 'example.jpg' file and displays it using your system's default image viewer.

    Congratulations! You've successfully installed and verified the Pillow library. You're now ready to explore the vast world of image processing with Python. Happy coding!