I am trying to build PIL for Win64 (x64, AMD64) (I am using Vista 64-bit).  
Appended are my notes on how I built and tested it (and the error messages).  
Any information on building a python Windows x64 extension (especially PIL) 
would help.  Thanks

---------------

This is essential b/c I am using python ctypes to control a 64-bit dll (and 
ctypes must be 64-bit to do this, which means the python install must be 
64-bit, which means the PIL install must be 64-bit).  I am trying to build a 
binary compatible PIL with my (python for x64, on windows vista) install.

http://docs.python.org/dist/module-distutils.msvccompiler.html
Says that I should use the "Platform SDK" to compile Windows AMD64 extensions.  
So I installed "Microsoft Windows SDK", and compiled from the console x64 
console.  I tried both consoles (Release , default Debug):
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft 
SDKs\Windows\v6.0\Bin\SetEnv.Cmd"
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft 
SDKs\Windows\v6.0\Bin\SetEnv.Cmd" /x64 /Release

I downloaded code for jpeg-6b, and compiled:
* rename jconfig.vc to jconfig.h
* nmake /f Makefile.vc

I downloaded code for zlib123 (png/zip support), and compiled:
* nmake /f win32/Makefile.msc

These folders I put in "PIL\Imaging-1.1.6\libs_External\jpeg-6b" and 
"PIL\Imaging-1.1.6\libs_External\zlib123"

I edited Imaging-1.1.6\setup.py:
* os.environ['DISTUTILS_USE_SDK'] = "1"
* os.environ['MSSdk'] = "1"
* JPEG_ROOT = r"libs_External\jpeg-6b"
* ZLIB_ROOT = r"libs_External\zlib123"

I compiled with distutils:
* setup.py clean
* setup.py build_ext -i
* setup.py build
* setup.py install

I ran "selftest.py" and I get the error:
Traceback (most recent call last):
  File "C:\Downloads\Installs\python\PIL\Imaging-1.1.6\selftest.py", line 11, 
in <module>
    import ImageMath
  File "PIL\ImageMath.py", line 19, in <module>
    import _imagingmath
ImportError: DLL load failed: A dynamic link library (DLL) initialization 
routine failed.

I also tried to run python:
>>> from PIL import Image
>>> refImg = Image.open(r"sample.png")
>>> refImg.getpixel((0,0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PIL\Image.py", line 922, in getpixel
    self.load()
  File "PIL\ImageFile.py", line 155, in load
    self.load_prepare()
  File "PIL\PngImagePlugin.py", line 339, in load_prepare
    ImageFile.ImageFile.load_prepare(self)
  File "PIL\ImageFile.py", line 223, in load_prepare
    self.im = Image.core.new(self.mode, self.size)
  File "PIL\Image.py", line 36, in __getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed

Neither of my dll (_imaging.pyd and _imagingmath.pyd) files are getting loaded 
properly by python :-(

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to