If you want to build PIL on Windows, you need to prepare few external libraries. Although some libraries did not provide static library for windows 32/64 bits then you need to build these libraries by your hand too. Also, PIL will load by python at last then you are recommended to use same compiler with python to build libraries.
PIL: | 1.1.7 for Python 2.4 (or Pillow-1.7.8) |
---|---|
PIL: | 1.1.7 for Python 2.5 (or Pillow-1.7.8) |
PIL: | 1.1.7 for Python 2.6 (or Pillow-1.7.8) |
PIL: | 1.1.7 for Python 2.7 (or Pillow-1.7.8) |
Python-2.4(32bit): | VisualStudio 7.1 (1310) (or VisualStudio 2003 Toolkit + Windows SDK) |
---|---|
Python-2.5(32bit): | VisualStudio 7.1 (1310) (or VisualStudio 2003 Toolkit + Windows SDK) |
Python-2.6(32bit): | VisualStudio 2008 (1500) (or VisualC++ 2008 Express) |
Python-2.7(32bit): | VisualStudio 2008 (1500) (or VisualC++ 2008 Express) |
You can choise production version or free version of VisualStudio.
freetype2: | 2.4.6 src (for VC7, VC2008) |
---|---|
jpeg6b: | 6b 27-Mar-1998 lib (for VC7), lib (for VC2008) |
LittleCMS: | 1.19 src |
tcl: | 8.5.10 src |
tk: | 8.5.10 src |
zlib: | 1.2.4 src |
- extract ft246.zip into
C:\lib\freetype-2.4.6
- open
builds\win32\vc2008\freetype.sln
by VC2008 - do build with
LIB Release
+Win32
- done! You got
objs\win32\vc2008\freetype246.lib
. - rename
freetype246.lib
tofreetype.lib
Note: You can use freetype246.lib file for VC2008 and VC7.
You can get built-static-lib from jpeg6b-vs2008.zip (for VS2008).
extract lib and headers as bellow:
C:\Lib\jpeg6-vs2008 +-- lib\libjpeg.lib +-- include\*.h
- extract
lcmls-1.19.tar.gz
intoC:\lib\lcms-1.19
- open
Projects\VC2008\lcms.sln
by VC2008 - do build with
LIB Release
+Win32
- done! You got
Lib\MS\lcms.lib
.
Note
You need to choice 1.x series of Little CMS for PIL.
.. todo:: validate this section.
- extract tcl8.5.10-src.tar.gz and tk8.5.10-src.tar.gz
- oepn
Visual Studio 2008 Command prompt
from start menu. - cd
C:\lib\tcl8.5.10\win
- nmake -f makefile.vc
- cd
C:\lib\tk8.5.10\win
- set
TCLDIR=C:\lib\tcl8.5.10
- nmake -f makefile.vc
- done! you got
C:\lib\tcl8.5.10\win\Release_VC9\tcl85.lib
andC:\lib\tk8.5.10\win\Release_VC9\tk850.lib
- extract
zlib124.zip
intoC:\lib\zlib-1.2.4
- open
projects\visualc6\zlib.vcproj
by VC2008 - do build
- done! You got
projects\visualc6\zlib.vcproj\Win32_LIB_Release
.
.. todo:: validate this section.
extract PIL source
write setup.cfg:
[build_ext] library_dirs = C:\lib\freetype-2.4.6\lib;C:\lib\jpeg6b-vs2008\lib;C:\lib\lcms-1.19\Lib\MS;C:\lib\tcl8.5.10\win\Release_VC9;C:\lib\tk8.5.10\win\Release_VC9;C:\lib\zlib-1.2.4\projects\visualc6\zlib.vcproj\Win32_LIB_Release; include_dirs = C:\lib\freetype-2.4.6\include;C:\lib\jpeg6b-vs2008\include;C:\lib\lcms-1.19\include;C:\lib\tcl8.5.10\generic;C:\lib\tk8.5.10\generic;C:\lib\tk8.5.10\xlib;C:\lib\zlib-1.2.4;
build (with inplace option for selftest):
python-2.7 -S setup.py build_ext -i build
self test:
python-2.7 -S selftest
make windows installer:
python-2.7 -S setup.py bdist_wininst