0

嗨,我是 GAE 和 python 的新手。我正在尝试使用 python 在 GAE 中创建小型 Web 应用程序。我打算在应用程序中使用Unirest模块。

我按照这篇文章中的说明进行操作,但出现以下错误。

没有名为 poster.encode 的模块

如何在 GAE 中成功安装 unirest?

谢谢

4

1 回答 1

0

添加import sys到您的main.py并添加这些行。

# inject './lib' dir in the path so that we can simply do "import ndb" or whatever there's in the app lib dir.
if 'lib' not in sys.path:
    sys.path[0:0] = ['lib']

在项目的根目录中创建lib文件夹,并将 unirest 文件夹复制到 lib 文件夹中。

您现在可以导入unirest并使用您的库。

但是,为什么不使用 Google App Engine 提供的标准方法和库呢?

于 2014-05-07T09:13:13.857 回答