Pular navegação

When I tried to install the Library PIL on a Ubuntu 8.04 where I had installed  Python 2.6 I got:

.
.
.
running build_ext
building ‘_imagingtk’ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/opt/python.org/python/python-2.6/include -I/usr/local/include -I/usr/include -I/opt/python.org/python/python-2.6/include/python2.6 -c _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

I’d founded the file ‘tk.h‘ on ‘/usr/include/tcl8.4‘ and after a look at the setup.py file I changed the line number 41 from:

TCL_ROOT = None

to

TCL_ROOT = “/usr/include/tcl8.4”

Now you can run your ‘python setup.py install’ again and get PIL working!

Note: You may perhaps have to install the tk-dev and tcl-dev packages before running the setup.py. I’d already had these packages, so I’m not sure about it.

On Ubuntu run:

apt-get install tk-dev tcl-dev

Deixe um comentário