在mingw / cygwin上构建时如何让PIL工作?

时间:2021-11-11 07:11:36

I'm trying to build PIL 1.1.6 against cygwin or mingw whilst running against a windows install of python. When I do either the build works but I get the following failure when trying to save files.

我正在尝试针对cygwin或mingw构建PIL 1.1.6,同时针对Windows安装的python运行。当我做任何一个构建工作,但我在尝试保存文件时遇到以下失败。

$ python25
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL.Image import open
>>> im = open('test.gif')
>>> im.save('output1.gif')
Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python25\Lib\site-packages\PIL\Image.py", line 1405, in save
    save_handler(self, fp, filename)
  File "c:\Python25\Lib\site-packages\PIL\GifImagePlugin.py", line 291, in _save

    ImageFile._save(imOut, fp, [("gif", (0,0)+im.size, 0, rawmode)])
  File "c:\Python25\Lib\site-packages\PIL\ImageFile.py", line 491, in _save
    s = e.encode_to_file(fh, bufsize)
IOError: [Errno 0] Error
>>>

I'm not compiling with the libraries for jpeg or zip support but I don't think this should be relevant here.

我没有编译jpeg或zip支持的库,但我不认为这应该与此相关。

The failing line seems to be a write in encode_to_file in encode.c.

失败的行似乎是在encode.c中写入encode_to_file。

I'm suspiscious that this occurs because a file descriptor is being passed from Python (which was build under visual studio 2003) to _imaging.pyd but that the file descriptors don't match because on windows file descriptors are and abstraction on top of the operating system. Does anyone know anything about this?

我怀疑这是因为文件描述符是从Python(在visual studio 2003下构建)传递到_imaging.pyd但是文件描述符不匹配,因为在Windows文件描述符上是和抽象的操作系统。有人对这个有了解吗?

1 个解决方案

#1


As far as I can tell from some cursory Google searching, you need to rebase the DLLs after building PIL in order for it to work properly on Cygwin.

据我粗略的谷歌搜索所说,你需要在构建PIL后重新绑定DLL,以便它在Cygwin上正常工作。

References:

#1


As far as I can tell from some cursory Google searching, you need to rebase the DLLs after building PIL in order for it to work properly on Cygwin.

据我粗略的谷歌搜索所说,你需要在构建PIL后重新绑定DLL,以便它在Cygwin上正常工作。

References: