- How To Install Pillow On Windows, Linux & Mac
- 1. What Is Pillow?
- 2. Pillow vs OpenCV vs Scikit-image.
- 3. Pillow Package Features.
- 4. How To Install Python Pillow Library.
- 4.1 Install Pillow Using Anaconda.
- 4.2 Install Pillow Using PIP Package Manager.
- 4.3 Install Pillow Using The Binary Package Files.
- 5. How To Use Pillow In Python Source Code.
- How to install easy-pil via python pip
- Installation:
- Step 1: First, ensure you installed pip in your os, to check pip has been installed on your computer
- Step 2: OK, now, let flow below content to start the installation easy-pil
- Step 3: If you want to install a specific easy-pil version, add == to the end command line
- Step 4: Otherwise, you can install easy-pil from local archives:
- Installation¶
- Simple installation¶
- External libraries¶
- Linux installation¶
- Mac OS X installation¶
- Windows installation¶
- Python Eggs¶
- Python Wheels¶
- Platform support¶
How To Install Pillow On Windows, Linux & Mac
Pillow can run across platforms, such as Windows, Linux, macOS, etc. The latest version is Pillow 8.4.0, which supports Python 3.6 and above (recommended). This article will tell you what is pillow, and how to install the python pillow module on Windows, Linux & macOS.
1. What Is Pillow?
- PIL (Python Imaging Library) is the third-party image processing library of Python. It is highly praised because of its rich functions and simple API.
- Since 2011, due to the slow update of the PIL library and only supporting Python version 2.7, it obviously can not meet the use requirements of Python version 3. So a group of Python community volunteers developed an image processing library supporting Python 3 based on the PIL library, which is Pillow.
- Pillow is not only a “replica” of the PIL library but also adds many new features to the PIL library. Till now, the pillow has become a more active image processing library than PIL.
- Now Pillow is the basic image processing library in Python that is used for basic images processing, such as cropping, resizing, and color processing.
2. Pillow vs OpenCV vs Scikit-image.
- In addition to the PIL and Pillow libraries, python also provides some other image processing libraries such as OpenCV, Scikit-image.
- OpenCV is actually a C++ image processing library, but it provides a Python interface.
- Scikit-image is an image processing software package based on Scipy that processes images in the form of arrays.
- Compared with Pillow, OpenCV and Scikit-image have richer functions, so they are more complex to use. They are mainly used in machine vision, image analysis, and other fields, such as the well-known “face recognition” application.
3. Pillow Package Features.
- Pillow supports a wide range of image formats, such as “JPEG”, “PNG”, “BMP”, “GIF”, “PPM”, “TIFF” and more. It also supports conversion between image formats.
- Pillow provides rich image processing capabilities that can be summarized in two areas, they are image archive and image processing.
- Image archiving includes creating thumbnails, generating preview images, image batch processing, etc.
- Image processing includes adjusting image size, cutting images, pixel processing, adding filters, image color processing, and so on.
- The Pillow library can be used with the Python GUI (graphical user interface) tool Tkinter.
- The Pillow library can also perform more complex image processing operations, such as adding watermarks to images and compositing animated gifs.
4. How To Install Python Pillow Library.
- Pillow installation is very simple and convenient, there are three ways to install the Pillow, they are 1) Install using PIP package manager, 2) Install using Anaconda, 3) Install using the binary package files.
- Note that the PIL library and Pillow library are not allowed to coexist in the same environment. If you have installed the PIL library before, please uninstall it and then install Pillow.
4.1 Install Pillow Using Anaconda.
- Anaconda is an open-source distribution of Python, it is a popular scientific computing platform, supporting Windows, Linux, and macOS systems ( you can refer to How To Install Anaconda On Linux, Windows, macOS Correctly). So we recommend you use it.
- Open the Anaconda navigator window, then click the Environments menu item on the Anaconda navigator left panel.
- Then select the virtual environment item that you need on the window’s middle side virtual environments list.
- On the window right side, select All from the drop-down list, then input the keyword pillow in the search box.
- If your anaconda has downloaded the pillow module, it will show the pillow module below the search box.
- You can check the checkbox before the pillow module and then click the Apply button to install it.
- You can read the article How To Install/Uninstall Python Packages In Anaconda Virtual Environment Successfully to learn more.
4.2 Install Pillow Using PIP Package Manager.
- Installing Pillow through the PPIP is the simplest, lightweight way to install it, and it works on any platform.
- Open a terminal and run the command pip install pillow in it to install the python pillow module.
- Then run the command pip show pillow to verify that pillow has been installed successfully.
$ pip show pillow Name: Pillow Version: 8.1.0 Summary: Python Imaging Library (Fork) Home-page: https://python-pillow.org Author: Alex Clark (PIL Fork Author) Author-email: [email protected] License: HPND Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages Requires: Required-by: vaex-viz, streamlit, matplotlib, ipyvolume
4.3 Install Pillow Using The Binary Package Files.
- Go to the pillow package files download page to download the pillow binary files that match your OS and version.
- Then open a terminal and run the below commands to install the pillow module with the above binary files.
- For Windows, you can run the command py -m pip install ./downloads/Pillow-8.4.0.tar.gz.
- For Linux & macOS, you can run the comand python3 -m pip install ./downloads/Pillow-8.4.0.tar.gz.
- You can read the Install a particular python module through the local source archive file to learn more.
5. How To Use Pillow In Python Source Code.
- Open a terminal and run the command python in it to open the python interpreter console.
- Then input the python source code from PIL import Image in the python console and press the enter key.
- If there is no error prompts, then it means the python pillow module has been installed successfully.
$ python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> >>> from PIL import Image # Import the Image class, which is an important class in pillow for Image processing.
How to install easy-pil via python pip
When you know about this project and you want to new install easy-pil to support your project or you get trouble as ModuleNotFoundError: No module named «easy-pil» or ImportError: cannot import name «easy-pil» in your project, let follow this tutorial to install easy-pil
Installation:
Step 1: First, ensure you installed pip in your os, to check pip has been installed on your computer
Ensure pip, setuptools, and wheel are up to date:
py -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pip setuptools wheel
Optional — If you want to install
— Install virtualenv — if you installed it, please ignore
py -m pip install --user virtualenv
— Create a virtual environment
py -m venv test_easy-pil_env
— Active the virtual environment
test_easy-pil_env\Scripts\active
— Install virtualenv — if you installed it, please ignore
— Create a virtual environment
python3 -m venv test_easy-pil_env
— Active the virtual environment
source test_easy-pil_env/bin/active
Step 2: OK, now, let flow below content to start the installation easy-pil
To install easy-pil on Windows(CMD):
To install easy-pil on Unix/macOs:
Step 3: If you want to install a specific easy-pil version, add == to the end command line
Please see the version list below table:
py -m pip install easy-pil==0.1.9
py -m pip install easy-pil==0.1.8
py -m pip install easy-pil==0.1.7
py -m pip install easy-pil==0.1.6
py -m pip install easy-pil==0.1.5
py -m pip install easy-pil==0.1.4
py -m pip install easy-pil==0.1.3
py -m pip install easy-pil==0.1.2
py -m pip install easy-pil==0.1.1
py -m pip install easy-pil==0.1.0
py -m pip install easy-pil==0.0.9
py -m pip install easy-pil==0.0.8
py -m pip install easy-pil==0.0.7
py -m pip install easy-pil==0.0.6
py -m pip install easy-pil==0.0.5
py -m pip install easy-pil==0.0.4
py -m pip install easy-pil==0.0.3
py -m pip install easy-pil==0.0.2
py -m pip install easy-pil==0.0.1
Step 4: Otherwise, you can install easy-pil from local archives:
Download the distribution file from easy-pil-0.1.9.tar.gz or the specific easy-pil version in the below list of distribution
After that, install by command:
Installation¶
Pillow >= 2.1.0 no longer supports “import _imaging”. Please use “from PIL.Image import core as _imaging” instead.
Pillow >= 1.0 no longer supports “import Image”. Please use “from PIL import Image” instead.
PIL and Pillow currently cannot co-exist in the same environment. If you want to use Pillow, please remove PIL first.
Pillow >= 2.0.0 supports Python versions 2.6, 2.7, 3.2, 3.3, 3.4
Simple installation¶
The following instructions will install Pillow with support for most formats. See External libraries for the features you would gain by installing the external libraries first. This page probably also include specific instructions for your platform.
You can install Pillow with pip:
Or easy_install (for installing Python Eggs, as pip does not support them):
Or download the compressed archive from PyPI, extract it, and inside it run:
External libraries¶
Many of Pillow’s features require external libraries:
- libjpeg provides JPEG functionality.
- Pillow has been tested with libjpeg versions 6b, 8, and 9
- Pillow has been tested with libtiff versions 3.x and 4.0
- Pillow version 2.2.1 and below uses liblcms1, Pillow 2.3.0 and above uses liblcms2. Tested with 1.19 and 2.2.
- Pillow has been tested with version 0.1.3, which does not read transparent webp files. Versions 0.3.0 and 0.4.0 support transparency.
- Pillow has been tested with openjpeg 2.0.0.
If the prerequisites are installed in the standard library locations for your machine (e.g. /usr or /usr/local ), no additional configuration should be required. If they are installed in a non-standard location, you may need to configure setuptools to use those locations (i.e. by editing setup.py and/or setup.cfg ). Once you have installed the prerequisites, run:
Linux installation¶
Fedora, Debian/Ubuntu, and ArchLinux include Pillow (instead of PIL) with their distributions. Consider using those instead of installing manually.
You do not need to install all of the external libraries to get Pillow’s basics to work.
We do not provide binaries for Linux. If you didn’t build Python from source, make sure you have Python’s development libraries installed. In Debian or Ubuntu:
$ sudo apt-get install python-dev python-setuptools
$ sudo apt-get install python3-dev python3-setuptools
$ sudo yum install python-devel
Prerequisites are installed on Ubuntu 10.04 LTS with:
$ sudo apt-get install libtiff4-dev libjpeg62-dev zlib1g-dev \ libfreetype6-dev tcl8.5-dev tk8.5-dev python-tk
Prerequisites are installed with on Ubuntu 12.04 LTS or Raspian Wheezy 7.0 with:
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \ libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk
Prerequisites are installed on Fedora 20 with:
$ sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel \ lcms2-devel libwebp-devel tcl-devel tk-devel
Mac OS X installation¶
You do not need to install all of the external libraries to get Pillow’s basics to work.
We do not provide binaries for OS X, so you’ll need XCode to install Pillow. (XCode 4.2 on 10.6 will work with the Official Python binary distribution. Otherwise, use whatever XCode you used to compile Python.)
The easiest way to install the prerequisites is via Homebrew. After you install Homebrew, run:
$ brew install libtiff libjpeg webp littlecms
If you’ve built your own Python, then you should be able to install Pillow using:
Windows installation¶
We provide binaries for Windows in the form of Python Eggs and Python Wheels:
Python Eggs¶
pip does not support Python Eggs; use easy_install instead.
Python Wheels¶
Experimental. Requires setuptools >=0.8 and pip >=1.4.1
$ pip install --use-wheel Pillow
If the above does not work, it’s likely because we haven’t uploaded a wheel for the latest version of Pillow. In that case, try pinning it to a specific version:
$ pip install --use-wheel Pillow==2.3.0
Platform support¶
Current platform support for Pillow. Binary distributions are contributed for each release on a volunteer basis, but the source should compile and run everywhere platform support is listed. In general, we aim to support all current versions of Linux, OS X, and Windows.
Contributors please test on your platform, edit this document, and send a pull request.