Under Mac installation PIL

Remember learning python with pictures, Mac environment

    We all know that Mac comes with python environment, but additional modules in dealing with special needs need to be installed.

    Directly on dry goods:

    1. Install PIL: http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz

     2. Run: cd-1.1.7 Imaging

     3. Run: sudo Python setup.py Build

      

     4.'ll find **** ZLIB (PNG / ZIP) support not available -> invalid does not support

     5. Next to download zlib, let PIL support

Download zlib:

      1. Address: https://sourceforge.net/projects/libpng/files/zlib/1.2.11/zlib-1.2.11.tar.gz/download?use_mirror=jaist&download=

      2. After downloading, go to the directory, in turn execute the command:

                                                                 ./configure

                                                                 make

                                                                 make install

        3. installation

   The Imaging-1.1.7 directory and run Python setup.py Build , after completion, will see that the place has supported. Then execute Python setup.py install . Soon, ready to use.

 

Another: libpng mounting method: brew install libpng

 

 

add to:

    Given as follows

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/tk.h:78:11: fatal error:

      'X11/Xlib.h' file not found

#       include <X11/Xlib.h>

                ^~~~~~~~~~~~

1 error generated.

error: command 'cc' failed with exit status 1

 

Solution: Run the command: sudo -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/ LN Headers / X11 / /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/X11

Note: according to their actual path

 

Note: The latest version of the Mac system (macOS Mojave 10.14.2) seems not to support the implementation of sudo brew. Pro-test

Prompt will pop up:

Error: Running Homebrew as root is extremely dangerous and no longer supported.

As Homebrew does not drop privileges on installation you would be giving all

build scripts full access to your system.

 

So directly run the following command to install lijpeg freetype

brew install libjpeg

brew install freetype

 

Append: If you find the above are installed, or will prompt does not support jpeg ( OError: Decoder not the Available jpeg ), you can try to install pillow, run the command: sudo PIP install -U Pillow

Released nine original articles · won praise 4 · views 10000 +

Guess you like

Origin blog.csdn.net/CN_DS/article/details/85121013