我正在构建我的第一个Python程序:)但是,我安装了Python 3.2而不是2.7,因为新版本包含了TkInter
。现在我找不到在里面使用PIL的方法。
我读过这个问题,但是作为一个新手,它对我没有多大帮助。我安装了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
是否有一种更简单的方法来启用PIL与PNG和JPEG支持Python 3?
一个选项是下载旧版本的Python,但不会有TkInter
?
Python 3.2的非官方PIL是答案http://www.lfd.uci.edu/gohlke/pythonlibs/
刚刚发现有PIL叉子枕头:https://pypi.python.org/pypi/Pillow/2.1.0
正如agf在他对你的问题的评论中提到的,tkinter已经包含在Python的每个版本中多年了。重要的区别是对tkinter包进行了重构。这些变化中最大的是基本包的名称:在Python 2. x中,tkinter包名为tkinter
,而在Python 2. x中。x中,包命名为Tkinter
(注意大写的"T")。您可以查看tkinter上的Python 2.7.2文档获取更多信息。
不幸的是,我还没有在Python 3中使用PIL。x,所以我不能提供任何帮助,但希望你能完成你需要的2.7代替。
请参阅http://mail.python.org/pipermail/image-sig/2012-October/007080.html获取在Python 2+3上运行的更新端口