[Image-SIG] Build PIL (python imaging library) in Debug mode (win64, AMD64)

Mowry, Peter peter.mowry at amd.com
Fri Aug 24 00:13:59 CEST 2007

I want to - Build PIL (python imaging library) in Debug mode (win64,

I built python2.5.1 using visual studios (for win64, AMD64)
(python_d.exe, etc).  For other extension modules, such as ctypes, I
just ran "python_d.exe setup.py", and setup.py automatically chose to
build ctypes_d.pyd (in debug mode).

But for PIL, I ran "python_d.exe setup.py", and it still tries to build
_imgaging.pyd (not _imaging_d.pyd - debug).  It looks for python25.lib
(instead of python25_d.lib).

How can I tell PIL to build me a python debug extension (using my custom
build of python2.5.1 debug python_d.exe) instead of a python release



4) build Python Imaging Library (for "import PIL")
  * our source has unmodified zlib123 (zlib 1.2.3) (from
http://www.zlib.net/) source (for zip / png support)
  * our source has unmodified ijg jpeg library (for jpeg support) (from

  a) Edit setup.py:
    # see http://docs.python.org/dist/module-distutils.msvccompiler.html
    os.environ['DISTUTILS_USE_SDK'] = "1"
    os.environ['MSSdk'] = "1"
    # see
    JPEG_ROOT = "jpeg-6b"
    TIFF_ROOT = None
    ZLIB_ROOT = "zlib-1.2.3"
    TCL_ROOT = None
    # ignore tkinter support since it wasn't working and I just want png
    # this step was not necessary for my build, but may be for some
    #import _tkinter
    import _tkinter_I_am_not_really_Importing_it

  b) open "Visual Studio 2005 x64 Win64 Command Prompt"

  c) build jpeg dependency:
    cd Imaging-1.1.6\jpeg-6b
    copy jconfig.vc jconfig.h
    nmake /f makefile.vc

  d) build zlib dependency
    cd Imaging-1.1.6\zlib-1.2.3
    nmake /f win32/Makefile.msc

  e) build PIL
    cd Imaging-1.1.6\
    ..\Build_Win64\python.exe setup.py build

TODO: - paths???
    Again, getting setup.py to build was messy b/c I wasn't sure how to
tell setup.py where to look for the missing files (python .h files and
    so I copied them to local folders in the PIL build - to hack the
build to work
      * copied headers (Python-2.5.1\Include\*.h)
(Python-2.5.1\PC\pyconfig.h) to (Imaging1.1.6\libImaging)
      * copied python25.lib to Imaging1.1.6\

More information about the Image-SIG mailing list