• Creator
  • #4017383

    Can’t install PIL after Mac OS X 10.9


    by auteur.intents.0z ·


    I’ve just updated my Mac OS to 10.9 and I discovered that some (all?) of my Python modules are not here anymore, especially the Image one.

    So I try to execute sudo pip install pil, but I get this error:

    /Applications/ fatal error: ‘X11/Xlib.h’ file not found

    # include <X11/Xlib.h>


    1 error generated.

    error: command ‘cc’ failed with exit status 1
    My Xcode is up-to-date and I don’t have any idea. Is it possible that PIL is not yet 10.9 compatible ?

All Answers

  • Author
    • #4017479
      Avatar photo

      See if this other forum has the answer.

      by rproffitt ·

      In reply to Can’t install PIL after Mac OS X 10.9

      I’m reading and it seems to address this one.

    • #4043899

      Reply To: Can’t install PIL after Mac OS X 10.9

      by anawilliam850 ·

      In reply to Can’t install PIL after Mac OS X 10.9

      The error message you are seeing suggests that the installation of the PIL (Python Imaging Library) module is failing due to a missing X11/Xlib.h file, which is required by the Tkinter module that PIL depends on.

      This error can occur if the Xcode command-line tools are not installed on your Mac or if the XQuartz package is not installed. XQuartz is a third-party package that provides X11 support for macOS.

      Here are some steps you can try to resolve the issue:

      Install Xcode command-line tools: Open Terminal and run the command xcode-select –install. This will prompt you to install the Xcode command-line tools if they are not already installed.

      Install XQuartz: If the Xcode command-line tools are installed but you still see the error, try installing XQuartz. You can download the latest version of XQuartz from the official website (

      Install the Pillow module instead: PIL is no longer being actively developed, and a newer fork called Pillow has emerged as a more up-to-date replacement. You can try installing Pillow instead of PIL by running the command sudo pip install pillow.

      If none of these steps help, you may need to seek further assistance or consider other image processing libraries for Python, such as OpenCV or scikit-image.

    • #4091205

      Reply To: Can’t install PIL after Mac OS X 10.9

      by oliver.david2027 ·

      In reply to Can’t install PIL after Mac OS X 10.9

      Pillow is a fork of the Python Imaging Library (PIL), which provides support for opening, manipulating, and saving many different image file formats. If you’re having trouble installing PIL on Mac OS X 10.9 or later, it’s likely because PIL is no longer actively maintained and has compatibility issues with newer versions of Python and macOS.

      Fortunately, Pillow is a popular and actively maintained fork of PIL that is compatible with newer versions of Python and macOS, and provides many of the same features and functionality as PIL. Here’s how you can install Pillow on your Mac:

      Open, which you can find in the Utilities folder inside your Applications folder.

      Use the following command to install the Pillow package using pip:

      Copy code
      pip install Pillow
      If you get a “permission denied” error, try using the sudo command to run the installation as an administrator:

      Copy code
      sudo pip install Pillow
      After the installation is complete, you can verify that Pillow is installed correctly by opening a Python interpreter and importing the Image module:

      Copy code
      $ python
      >>> from PIL import Image
      >>> Image.__version__
      If the installation is successful, you should see the version number of the Pillow package that you just installed. You can now use the Pillow package to work with images in your Python code.

Viewing 2 reply threads