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.
Pillow: | 1.7.8 for Python 2.7: src |
---|
Python-2.6 (x32|x64): | VisualC++ 2008 Express SP1 + Windows SDK 2008 |
---|---|
Python-2.7 (x32|x64): | VisualC++ 2008 Express SP1 + Windows SDK 2008 |
Python-2.4 and 2.5 need VisualStudio 7.1. see also https://gist.github.com/shimizukawa/4634344
freetype2: | 2.4.11 src |
---|---|
jpeg6b: | 6b 27-Mar-1998 src |
LittleCMS: | 1.19 src |
tcl: | 8.5.13 src |
tk: | 8.5.13 src |
zlib: | 1.2.7 src |
- invoke Windows SDK's
CMD Shell
fromStart -> Microsoft Windows SDK v6.1 -> CMD Shell
- type
setenv /x86 /release
orsetenv /x64 /release
which you want. - type
set libpath=dummy
- extract
freetype-2.4.11.tar.bz2
intoC:\opt\freetype-2.4.11
cd builds\win32\vc2008
- (Win64): open *.sln, *.vcproj by text editor and replace Win32 with x64.
- (Win32):
vcbuild.exe freetype.sln /rebuild "LIB Release|Win32"
- (Win64):
vcbuild.exe freetype.sln /rebuild "LIB Release|x64"
- (Win32):
- done! You got
objs\win32\vc2008\freetype2411.lib
. - rename
freetype2411.lib
tofreetype.lib
- extract
jpegsr6b.zip
intoC:\opt\jpeg-6b
- rename
jconfig.vc
tojconfig.h
nmake -f makefile.vc
- done! You got
libjpeg.lib
.
- extract
lcms-1.19.zip
intoC:\opt\lcms-1.19
cd Projects\VC2008
- (Win64): open *.sln, *.vcproj by text editor and replace Win32 with x64.
- (Win32):
vcbuild.exe lcms.sln /rebuild "Release|Win32"
- (Win64):
vcbuild.exe lcms.sln /rebuild "Release|x64"
- (Win32):
- done! You got
Lib\MS\lcms.lib
.
Note
You need to choose 1.x series of Little CMS for PIL.
- extract
tcl8.5.13-src.zip
andtk8.5.13-src.zip
cd C:\opt\tcl8.5.13\win
nmake -f makefile.vc INSTALLDIR=C:\opt\tcl release
nmake -f makefile.vc INSTALLDIR=C:\opt\tcl install
cd C:\lib\tk8.5.13\win
nmake -f makefile.vc TCLDIR=..\\..\\tcl8.5.13 INSTALLDIR=C:\opt\tcl release
nmake -f makefile.vc TCLDIR=..\\..\\tcl8.5.13 INSTALLDIR=C:\opt\tcl install
- done! you got
C:\opt\tcl\lib\tcl85.lib
andC:\opt\tcl\lib\tk85.lib
- extract
zlib127.zip
intoC:\opt\zlib-1.2.7
cd contrib\vstudio\vc9
- (Win64): open *.sln, *.vcproj by text editor and replace Win32 with x64.
- (Win32):
vcbuild.exe zlibstat.vcproj /rebuild "ReleaseWithoutAsm|Win32"
- (Win64):
vcbuild.exe zlibstat.vcproj /rebuild "ReleaseWithoutAsm|x64"
- (Win32):
- done! You got
contrib\vstudio\vc9\(x86|x64)\ZlibStatReleaseWithoutAsm\zlibstat.lib
. - rename
zlibstat.lib
tozlib.lib
extract PIL source into
C:\opt\pillow
write setup.cfg:
[build_ext] library_dirs = C:\opt\freetype-2.4.11\objs\win32\vc2008\freetype2411.lib;C:\opt\jpeg-6b;C:\opt\lcms-1.19\Lib\MS;C:\opt\tcl;C:\opt\zlib-1.2.7\contrib\vstudio\vc9\x64\ZlibStatReleaseWithoutAsm; include_dirs = C:\opt\freetype-2.4.11\include;C:\opt\jpeg-6b;C:\opt\lcms-1.19\include;C:\opt\tcl\include;C:\opt\zlib-1.2.7;
- 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 if you want::
python-2.7 -S setup.py bdist_wininst
- make binary egg package if you want::
python-2.7 -S setup.py bdist_egg
s