我正在构建我的第一个Python程序:)但是,我安装了Python 3.2而不是2.7,因为新版本包含TkInter
。现在我找不到在其中使用PIL的方法。
我读过this question但作为一个新手,对我来说没什么用。我安装了zlib和libjpeg但是在构建pil-py3k时无法进一步了解。我不知道我应该在这做什么:
# --------------------------------------------------------------------
# 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
是否有更简单的方法为Python 3启用支持PNG和JPEG的PIL?
一种选择是下载旧版本的Python,但不会有TkInter
?
我希望你明白我是新人,所以如果我提出任何愚蠢的问题,请原谅我。 Python看起来很酷! ;)任何帮助表示赞赏。
答案 0 :(得分:8)
Python 3.2的非官方PIL就是答案 http://www.lfd.uci.edu/~gohlke/pythonlibs/
答案 1 :(得分:5)
答案 2 :(得分:0)
正如agf在他对你的问题的评论中提到的那样,tkinter已被包含在每个版本的Python中多年。重要的区别是tkinter包的重组。这些更改中最大的一个是基本软件包名称:在Python 3.x中,tkinter软件包名为tkinter
,而在Python 2.x中,软件包名为Tkinter
(注意资本“T” “)。您可以在tkinter上看到Python 2.7.2 docs以获取更多信息。
不幸的是,我没有将PIL与Python 3.x一起使用,所以我不能在那里提供任何帮助,但希望你能在2.7中完成你所需要的。
答案 3 :(得分:0)
有关适用于Python 2 + 3
的更新端口,请参阅http://mail.python.org/pipermail/image-sig/2012-October/007080.html