【问题标题】:Matplotlib with Google App EngineMatplotlib 与 Google App Engine
【发布时间】:2013-01-27 03:21:31
【问题描述】:

我在将 matplotlib 导入谷歌应用引擎时遇到问题。我用谷歌搜索并找到了一些解决方案,但似乎没有一个对我有用。在我的 app.yaml 文件中,我有

libraries:
- name: matplotlib
  version: latest  
- name: numpy
  version: latest

在我的 python 文件中,我将导入我可以拥有的 numpy

numpy.arange(10)

问题是当我尝试导入 matplotlib 时

import matplotlib as plt

访问页面时出现此错误

The website encountered an error while retrieving http://localhost:8080/. 
It may be down for maintenance or configured incorrectly.

我删除了 matplotlib 导入,刷新,一切都恢复正常了。我看到应用引擎网页使用 matplotlib,例如 http://gae-matplotlib-demo.appspot.com 导入 matplotlib,所以我知道这是可能的。

如何在 Google App Engine 中使用 matplotlib?

【问题讨论】:

标签: python google-app-engine import matplotlib


【解决方案1】:

不幸的是,Matplotlib 目前不能在 GAE 开发应用服务器中运行,如库页面上的 Matplotlib notes 中所述。如果您使用 appcfg 将其部署到生产服务器,它应该可以工作。不过,我意识到这对于开发来说并不理想。当开发服务器支持 Matplotlib 时,我们将更新该页面。

正如@mjibson 指出的那样,Dima Tisnek 有worked out a way 让它在开发应用程序服务器中运行,但它涉及一些黑客攻击,我们不正式支持这种方法。 (作为记录,我能够使用这种方法使其工作。)

马特·朱卡

谷歌

【讨论】:

  • 谢谢。我对为什么我什至无法导入模块感到有些困惑。希望 GAE 尽快更新,以便我们可以在开发服务器上使用 matplotlib。
猜你喜欢
  • 2016-12-18
  • 2016-11-07
  • 1970-01-01
  • 2012-07-08
  • 1970-01-01
  • 2021-10-23
  • 2011-10-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多