Matplotlib与Google App Engine

Jak*_*zer 4 python import google-app-engine matplotlib

我无法将matplotlib导入谷歌应用引擎.我用Google搜索并找到了一些解决方案,但它们似乎都不适合我.在我的app.yaml文件中

libraries:
- name: matplotlib
  version: latest  
- name: numpy
  version: latest
Run Code Online (Sandbox Code Playgroud)

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

numpy.arange(10)
Run Code Online (Sandbox Code Playgroud)

问题是当我尝试导入matplotlib时

import matplotlib as plt
Run Code Online (Sandbox Code Playgroud)

访问该页面时出现此错误

The website encountered an error while retrieving http://localhost:8080/. 
It may be down for maintenance or configured incorrectly.
Run Code Online (Sandbox Code Playgroud)

我删除matplotlib导入,刷新,一切都有效.我见过app引擎网页使用matplotlib,例如http://gae-matplotlib-demo.appspot.com导入matplotlib所以我知道它是可能的.

如何在Google App Engine中使用matplotlib?

mgi*_*uca 5

不幸的是,Matplotlib目前不在GAE Dev Appserver中工作,正如Matplotlib在库页面上的说明中所解释的那样.如果使用appcfg将其部署到生产服务器,它应该可以工作.但我意识到这不适合开发.当开发服务器支持Matplotlib时,我们将更新该页面.

正如@mjibson指出的那样,Dima Tisnek已经找到了一种让它在dev appserver中运行的方法,但它涉及到一些黑客行为,我们并没有正式支持这种方法.(为了记录,我能够使用这种方法.)

Matt Giuca

谷歌

  • 谢谢.我有点困惑为什么我甚至无法导入模块.希望GAE尽快更新,以便我们可以在开发服务器上使用matplotlib. (2认同)