在Cygwin上安装PIL

3 投票
2 回答
3161 浏览
提问于 2025-04-15 22:23

我今天早上一直在努力在Cygwin上安装PIL(Python Imaging Library)。但是我遇到的错误和网上常见的错误不太一样,搞得我很困惑。也许有懂Linux的高手能从这个输出中看出明显的问题:

$ python setup.py install
running install
running build
running build_py
running build_ext
building '_imaging' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.cygwin-1.7.2-i686-2.5/_imaging.o
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/syslimits.h:7,
                 from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/limits.h:11,
                 from /usr/include/python2.5/Python.h:18,
                 from _imaging.c:75:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/limits.h:122:61: limits.h: No such file or directory
In file included from _imaging.c:75:
/usr/include/python2.5/Python.h:32:19: stdio.h: No such file or directory
/usr/include/python2.5/Python.h:34:5: #error "Python.h requires that stdio.h define NULL."
/usr/include/python2.5/Python.h:37:20: string.h: No such file or directory
/usr/include/python2.5/Python.h:39:19: errno.h: No such file or directory
/usr/include/python2.5/Python.h:41:20: stdlib.h: No such file or directory
/usr/include/python2.5/Python.h:43:20: unistd.h: No such file or directory
/usr/include/python2.5/Python.h:55:20: assert.h: No such file or directory
In file included from /usr/include/python2.5/Python.h:57,
                 from _imaging.c:75:
/usr/include/python2.5/pyport.h:7:20: stdint.h: No such file or directory
In file included from /usr/include/python2.5/Python.h:57,
                 from _imaging.c:75:
/usr/include/python2.5/pyport.h:89: error: parse error before "Py_uintptr_t"
/usr/include/python2.5/pyport.h:89: warning: type defaults to `int' in declaration of `Py_uintptr_t'
/usr/include/python2.5/pyport.h:89: warning: data definition has no type or storage class
/usr/include/python2.5/pyport.h:90: error: parse error before "Py_intptr_t"
/usr/include/python2.5/pyport.h:90: warning: type defaults to `int' in declaration of `Py_intptr_t'

... 还有更多类似的行

2 个回答

0

你可以下载一个新的cygwin安装包,然后在Python部分安装图像处理库。这样就可以在cygwin的Python 2.7中使用PIL了。

1

看起来你需要安装GNU libC,因为syslimits.h、limits.h、errno.h、stdlib.h、assert.h等文件都是属于这个库的。

如果你在Windows上,可以找到二进制安装包;如果你不想在CYGWIN环境下自己编译PIL,可以从这些链接中选择一个安装包,http://www.pythonware.com/products/pil/#Downloads

撰写回答