tutorial on installing the Python Pillow Library on Mac OS systems

Source: Internet
Author: User
Tags webp macbook
Today help a friend to make a Python gadget, found that the system is missing Ptyhon support library, return the following information

Importerror:no module named PIL
Then download the installation, because there is no Python management tool PIP on the machine, so it is also installed
1. Install Pip

PIP installation is successful and can be installed directly PIL or pillow


2. Via command pip install PIL

Downloading/unpacking Pil  Could not find any downloads that satisfy the requirement Pil  

3. So just install Pillow

Downloading/unpacking Pillow  

Get the other back found not downloaded, it is called a slow ah, so give up
4. Git

Download the source address via Git https://github.com/python-imaging/Pillow

Then start compiling the installation

4.1

After compiling, you will be prompted to run the test example and find that JPEG support is not available

--------------------------------------------------------------------version   Pillow 2.4.0 platform   Darwin 2.7.5 (default, 00:04:04)        [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]------------------------ -----------------------------------------------TKINTER support available * * * JPEG support Not Available * * * * OPENJPEG (JP  EG2000) Support Not available---ZLIB (png/zip) Support available * * LIBTIFF support not available---FREETYPE2 support Available * * * LITTLECMS2 support Not available * * * WEBP support Not available * * WEBPMUX support not available--------- -----------------------------------------------------------to add a missing option, make sure you have the required Libra Ry, and set the corresponding ROOT variable in the setup.py script.  

4.2 Run Python selftest.py report error because JPEG support is not available


1 tests of failed.

So I had to unload pillow

The PIP command can be used to uninstall

Password:uninstalling Pillow:  /library/python/2.7/site-packages/pillow-2.4.0-py2.7-macosx-10.9-intel.egg  /usr/local/bin/pilconvert.py  /usr/local/bin/pildriver.py  /usr/local/bin/pilfile.py  /usr/local /bin/pilfont.py  /usr/local/bin/pilprint.py Proceed (y/n)? y  
Successfully uninstalled Pillow

After success, you need to install LIBJPEG support

Recompile pillow after successful installation

--------------------------------------------------------------------version Pillow 2.4.0 platform Darwin 2.7.5 (DEFA Ult, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]-------------------------------- ---------------------------------------TKINTER support available---JPEG support available * * * OPENJPEG (JPEG2000) Supp ORT not available---ZLIB (png/zip) Support available * * LIBTIFF support not available---FREETYPE2 support available * * * LITTLECMS2 Support Not available * * * WEBP support Not available * * * WEBPMUX support not available--------------------- -----------------------------------------------python selftest.py---------------------------------------------- ----------------------Pillow 2.4.0 TEST SUMMARY------------------------------------------------------------------ --Python modules loaded From/users/macbook/yyang/app-devel-source/python/pillow/pil Binary modules loaded from/users/ Macbook/yyang/app-devel-source/python/pilLow/pil-----------------------------------------------------------------------PIL CORE support OK---TKINTER Support OK---JPEG support OK * * * JPEG installed---ZLIB (png/zip) Support OK * * * LIBTIFF support Not I nstalled---FREETYPE2 support OK * * * LITTLECMS2 support Not installed * * * WEBP support not installed--------------------  ------------------------------------------------Running selftest:---tests passed.

Final execution of the installation

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.