stone2083

ubuntu下安装Python Imaging Library (PIL)

easy_install is not so easy。
这是我最近在学习python的一丝体会,好多lib都无法通过easy_install安装,比如:Python Imaging Library (PIL)

只能通过手工安装方式安装:
*download the pil_1.1.6
*tar xvf Imaging-1.1.6.tar.gz & chmox +x setup.py
*python setup.py build

结果,居然:
 _imagingtk.c -o build/temp.linux-i686-2.6/_imagingtk.o
_imagingtk.c:
20:16: error: tk.h: No such file or directory
_imagingtk.c:
23: error: expected ‘)’ before ‘*’ token
_imagingtk.c:
31: error: expected specifier-qualifier-list before ‘Tcl_Interp’
_imagingtk.c: In function ‘_tkinit’:
_imagingtk.c:
37: error: ‘Tcl_Interp’ undeclared (first use in this function)
_imagingtk.c:
37: error: (Each undeclared identifier is reported only once
_imagingtk.c:
37: error: for each function it appears in.)
_imagingtk.c:
37: error: ‘interp’ undeclared (first use in this function)
_imagingtk.c:
45: error: expected expression before ‘)’ token
_imagingtk.c:
51: error: ‘TkappObject’ has no member named ‘interp’
_imagingtk.c:
55: warning: implicit declaration of function ‘TkImaging_Init’
error: command 'gcc' failed with exit status 
1

tk.h No such file or directory

事实上,tk-dev包我已经安装了,查看setup.py代码,发现:
# Library pointers.
#
#
 Use None to look for the libraries in well-known library locations.
#
 Use a string to specify a single directory, for both the library and
#
 the include files.  Use a tuple to specify separate directories:
#
 (libpath, includepath).  Examples:
#
#
 JPEG_ROOT = "/home/libraries/jpeg-6b"
#
 TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include"
#
#
 If you have "lib" and "include" directories under a common parent,
#
 you can use the "libinclude" helper:
#
#
 TIFF_ROOT = libinclude("/opt/tiff")

FREETYPE_ROOT 
= None
JPEG_ROOT 
= None
TIFF_ROOT 
= None
ZLIB_ROOT 
= None
TCL_ROOT 
= None

将TCL_ROOT = None 修改成:TCL_ROOT = '/usr/include/tk',即可

python setup.py build
python setup.py install

成功 :)

posted on 2009-10-27 17:25 stone2083 阅读(3082) 评论(1)  编辑  收藏 所属分类: python

Feedback

# re: ubuntu下安装Python Imaging Library (PIL) 2010-11-05 06:52 cyc

我提示的错误和你不一样,是gcc无法编译。。。唉。。
郁闷啊  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: