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

发布于 2024-07-10 18:48:15 字数 1090 浏览 6 评论 0原文

我正在尝试针对 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
>>>

我没有使用 jpeg 或 zip 支持的库进行编译,但我认为这与这里无关。

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

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

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.

$ 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.

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风来 2024-07-17 18:48:15

据我从一些粗略的 Google 搜索中可以看出,您需要在构建 PIL 后重新设置 DLL 的基础,才能使其在 Cygwin 上正常工作。

参考文献:

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.

References:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文