Can PIL be used in python 3 (not pillow)

660 Views Asked by At

In python for android project , I found in pil recipe https://github.com/kivy/python-for-android/blob/master/pythonforandroid/recipes/pil/init.py

depends = [('python2', 'python3crystax'), 'png', 'jpeg']

Isn't python3crystax for python3!! so i tried to figure it and I added python3crystax to the requirements in buildozer spec file, but error appeares(as expected)

Am i missing something

*****error****

INFO]: Building compiled components in pil
[INFO]: -> directory context /home/sherif/Desktop/Project/.buildozer/android/platform/build/build/other_builds/pil-python3crystax/armeabi-v7a/pil
[INFO]: -> running python3.5 setup.py build_ext -v
working: File "setup.Exception in thread background thread for pid 27914:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
ErrorReturnCode_1:

RAN: /usr/bin/python3.5 setup.py build_ext -v

STDOUT:
File "setup.py", line 159
print "--- using Tcl/Tk libraries at", TCL_ROOT
^
SyntaxError: Missing parentheses in call to 'print'

STDERR:

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in run_code
3

There are 3 best solutions below

1
On

I'm not familiar with python-for-android and "python3crystax". But on PIL website it says

The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later.

0
On

It looks like the python3crystax optional requirement here is a mistake. I'll remove it.

I've seen pillow recipes proposed, but none have made it into the recipes yet. You can probably find one to use if you like.

0
On

No, PIL does not support Python 3.

Python 3 support was added in Pillow, the maintained PIL fork, in version 2.0.0 released on 15th March 2013.

It was quite a big effort adding Python 3 support, with 230 files changed. See the pull request.