2

我正在开发python google app engine应用程序,我正在使用python2.5,我想处理GAE(过滤图像)上的图像,最初我尝试了wit PIL库并且我成功安装了它并且我测试了它并且它可以工作在我的计算机上正确,但是当我在 localhost(在 GAE 上运行)上测试它时,我有一个错误NotImplementedError: Unable to find the Python PIL library,然后我尝试使用 Images Python API 处理图像,如本教程中所示:https ://developers.google.com /appengine/docs/python/images/overview,并且我测试了调整图像大小服务,它工作正常,但我想要的主要应用程序是过滤图像,问题是:如果 GAE 中的图像 Python API 支持此服务(图像过滤)?我在 GAE 上过滤图像?我看到 PIL 中提供了此服务并对其进行了测试,但 GAE 在 python2.5 中不支持此库

编辑:

我尝试使用 python2.7 在 GAE 上使用 PIL 库作为https://developers.google.com/appengine/docs/python/python27/using27#Configuring_Libraries,我安装了 PIL 1.1.7,并配置了app.yaml文件作为:

application: app_id
version: 1
runtime: python27
api_version: 1
threadsafe: false
handlers:
- url: /.*
  script: main.py
libraries:
- name: PIL
  version: "1.1.7"

现在我如何在 main.py 页面中使用这个库?我试过了from PIL import Image,但问题仍然是:

No module named PIL 
      args = ('No module named PIL',) 
      message = 'No module named PIL'

提前致谢。

4

2 回答 2

6

使用 python2.5,PIL 本身不可用。内置图像模块使用类似于 PIL 的 API,并且使用 SDK(在您的计算机上)PIL 用于兼容性,因此您需要安装它。文档(上一个链接)有关于如何在 windows/mac/linux 上执行此操作的说明。

使用 python2.7,您需要将您的应用程序配置为在部署后使用 PIL 的应用程序引擎版本。在本地,您需要在应用程序文件夹之外自己安装 PIL。

于 2012-04-16T18:26:08.143 回答
3

没有import PIL它的import Image

于 2012-04-18T19:57:56.207 回答