使用pythononmac.org软件包安装后,无法使用PIL(Mac OS Leopard) [英] Unable to use PIL after installing using pythononmac.org package (Mac OS Leopard)

查看:91
本文介绍了使用pythononmac.org软件包安装后,无法使用PIL(Mac OS Leopard)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将PIL用于Google App Engine项目.我已经使用pythononmac.org的安装程序安装了PIL,但是没有安装似乎什么也没做,或者至少我和Python都找不到文件.我正在运行Python 2.5.1.

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.

推荐答案

在该页面上找到的安装程序旨在与在那里找到的python 2.5安装程序一起使用.请注意,大多数软件包现在已过期. PIL安装程序在该页面上的2.5 Python和更新的python.org安装程序/Library/Frameworks/Python.framework/Versions/2.5使用的框架中使用site-packages库.苹果提供的Python 2.5(在OS X 10.5中的/usr/bin/python2.5)在其他位置查找site-packages:/Library/Python/2.5.如果您首先安装 python.org (或pythonmac.org) 2.5,可以由/usr/local/bin/python2.5调用python,并且PIL安装程序包应与之配合使用.

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.

不幸的是,在OS X上安装PIL比许多其他python软件包要复杂得多,因为它依赖于OS X中非Apple提供的第三方库.虽然可以自行构建,但可能会更好例如,请从 MacPorts 使用带有PIL的最新版本的python(请参见软件包py25-pilpy26-pil).

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).

我不建议使用某些博客所倡导的symlink技巧(例如,

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.

这篇关于使用pythononmac.org软件包安装后,无法使用PIL(Mac OS Leopard)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆