Unable to use PIL after installing using pythononmac.org package (Mac OS Leopard)

邮差的信 提交于 2019-12-13 03:56:59

问题


I'm trying to use PIL for a Google App Engine project. I've installed PIL using the installer from pythononmac.org but it doesn't seem to do anything, or at least neither I nor Python can find the files. I'm running Python 2.5.1.


回答1:


The installers found on that page were designed to be used with the python 2.5 installer found there. Note that most of the packages are now out-of-date. The PIL installer uses the site-packages library in the framework used by the 2.5 Python on that page and by the more up-to-date python.org installer: /Library/Frameworks/Python.framework/Versions/2.5. The Apple-supplied Python 2.5 (/usr/bin/python2.5 in OS X 10.5) looks for site-packages in a different location: /Library/Python/2.5. If you first install the python.org (or the pythonmac.org) 2.5, that python can be invoked by /usr/local/bin/python2.5 and the PIL installer package should work with it.

Unfortunately, installing PIL on OS X is more complicated than many other python packages because of its dependence on third-party libraries not supplied by Apple in OS X. While it is possible to build it on your own, you may be better off using a more up-to-date version of python with PIL from MacPorts, for example (see packages py25-pil or py26-pil).

I do not recommend using the symlink trick advocated by some bloggers (for instance, here) as this can end up contaminating the Apple-supplied Python and complicating support of multiple Python versions when you want to upgrade to python 2.6 and/or 3.1.



来源:https://stackoverflow.com/questions/1774825/unable-to-use-pil-after-installing-using-pythononmac-org-package-mac-os-leopard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!