2008年6月11日 星期三

Install PIL (Python Image Library) at Bluehost.com

I tried to install PIL1.1.6 at Bluehost and encoutered the following error messages:



bash#python setup.py install --prefix=$HOME
......
......
_imagingtk.c:20:16: tk.h: No such file or directory
_imagingtk.c:23: error: syntax error before '*' token
_imagingtk.c:31: error: syntax error before "Tcl_Interp"
_imagingtk.c:31: warning: no semicolon at end of struct or union
_imagingtk.c:32: warning: data definition has no type or storage class
_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: syntax error before ')' token
_imagingtk.c:50: error: `app' undeclared (first use in this function)
_imagingtk.c:50: error: syntax error before ')' token
_imagingtk.c: At top level:
_imagingtk.c:55: warning: parameter names (without types) in function declaration
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: warning: data definition has no type or storage class
_imagingtk.c:57: error: syntax error before '&' token
error: command 'gcc' failed with exit status 1
The problem can be corrected by not importing tkinter. Modify the program block of the file "setup.py"

try:
import _tkinter
except ImportError:
_tkinter = None

to the following

_tkinter = None

With this, PIL would not be compiled with tkinter support.

1 則留言:

PY 提到...

This would make PIL not support JPEG because of missing library (libjpeg). Therefore, I have to compile a python2.5 from the ground and install in the home directory.
####
./configure --prefix=$HOME
make
make install
####

When PIL was compiled, modify setup.py by setting up JPEG library root
####
JPEG_ROOT = /usr/lib64
####

Then PIL could be compiled successfully with JPEG support.