谷歌应用引擎:“无法初始化图像API”,即使安装了PIL

时间:2013-06-27 18:19:59

标签: python google-app-engine python-imaging-library

我正在尝试启动谷歌应用引擎(GAE)并在共享的Linux工作站上运行。使用管理员提供的标准python发行版,几乎一切都运行得很好,除了PIL模块没有使用zlib支持编译,这打破了我的web应用程序,所以我决定在我的家庭目录中进行Python的自定义构建,以便我可以控制Python和py包。 Python编译得很好,PIL编译得很好,同时支持jpeg和zlib。但是,当我尝试使用我的新Python运行GAE时,它抱怨PIL不可用。

以下是我构建的输出:

% /path/to/custom/python/bin/python
Python 2.7.5 (default, Jun 27 2013, 11:17:33) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

PIL

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.5 (default, Jun 27 2013, 11:17:33)
              [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

在我的新Python构建中,我可以很好地导入PIL:

% /path/to/custom/python/bin/python
Python 2.7.5 (default, Jun 27 2013, 11:17:33) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>> 

哦,以及app.yaml中的相关部分:

libraries:
- name: PIL
  version: "1.1.7"

但是当我启动GAE时,它抱怨PIL无法使用:

% /path/to/custom/python/bin/python dev_appserver.py ~/Dropbox/personal_website-dev
INFO     2013-06-27 18:05:07,273 sdk_update_checker.py:244] Checking for updates to the SDK.
INFO     2013-06-27 18:05:07,671 sdk_update_checker.py:272] The SDK is up to date.
WARNING  2013-06-27 18:05:07,705 api_server.py:314] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO     2013-06-27 18:05:07,711 api_server.py:138] Starting API server at: http://localhost:57893
INFO     2013-06-27 18:05:08,021 dispatcher.py:164] Starting server "default" running at: http://localhost:8080
INFO     2013-06-27 18:05:08,026 admin_server.py:117] Starting admin server at: http://localhost:8000

我已经将/ path / to / custom / python / bin添加为我的PATH中的第一项,所以我真的不明白GAE在做什么大惊小怪。我可以导入PIL。为什么GAE不能?

1 个答案:

答案 0 :(得分:1)

这个谷歌小组的帖子说你可以放心地忽略它。

https://groups.google.com/forum/#!topic/google-appengine-go/gDImZqkPOp8

相关信息:

  

请忽略该警告。它来自Python运行时(也使用dev_appserver.py),可以安全地被忽略。