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.7
VisualC++ 2008 Express SP1 + Windows SDK 7.0
- 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
- make sure
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin
is in your PATH.
- make sure
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64
is in your PATH. - Copy this file:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat
to this follow folder and rename the file (vcvars64.bat to vcvarsamd64.bat):C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat
- extract
freetype-2.4.11.tar.bz2
intoC:\opt\freetype-2.4.11
- apply the
ft2411_windows.patch
patch cd builds\win32\vc2008
- (Win32):
vcvars32.bat
(Win64):
vcvarsamd64.bat
- (Win32):
- (Win32):
VCExpress.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
- extract the
jpeg-6b.sln
andjpeg-6b.vcproj
from the jpeg6bvcconf-patch toC:\opt\jpeg-6b
- (Win32):
vcvars32.bat
(Win64):
vcvarsamd64.bat
- (Win32):
- (Win32):
VCExpress.exe jpeg-6b.sln /rebuild "Release|Win32"
(Win64):
vcbuild.exe jpeg-6b.sln /rebuild "Release|x64"
- (Win32):
- done! You got
Release\jpeg-6b.lib
. - rename
jpeg-6b.lib
tolibjpeg.lib
- extract
lcms-1.19.zip
intoC:\opt\lcms-1.19
- apply the
lcms119_windows.patch
patch cd Projects\VC2008
- (Win32):
vcvars32.bat
(Win64):
vcvarsamd64.bat
- (Win32):
- (Win32):
VCExpress.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
- (Win32):
vcvars32.bat
(Win64):
vcvarsamd64.bat
- (Win32):
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
- apply the
zlib127_windows.patch
patch cd contrib\vstudio\vc9
- (Win32):
vcvars32.bat
(Win64):
vcvarsamd64.bat
- (Win32):
- (Win32):
VCExpress.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
- apply the
pillow178_win(32|64).patch
patch - 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
Thanks! I could build x64 Pillow binaries but have a little difference.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat
without copying into amd64.