我正在尝试让 oauth 在 Google App Engine (GAE) 上运行,但我无法导入 OAuth2Decorator
, 因为它试图导入 gflags
并失败了。
在命令行中我运行了 help('modules')
并且列出了 gflags,我已经运行了 import os
+ import gflags
+ print os.path.dirname(gflags.__file__)
并收到/Library/Python/2.7/site-packages/python_gflags-2.0-py2.7.egg
.
我在 GAE Dev Console 中运行过:
import sys
import os
try:
import webapp2
import httplib2
from oauth2client.appengine import OAuth2Decorator
except ImportError, e:
print("The import failed!")
print(e)
并收到:
The import failed!
No module named gflags
gflags
由 from oauth2client.appengine import OAuth2Decorator
导入, 但 GAE 无法导入 gflags
每次我运行代码。
我不确定这有什么不同,但我运行的是 Mac OS 10.7.5 和 python 2.7.1
最佳答案
抱歉,我最近用 App Engine 特定说明更新了安装说明:
https://developers.google.com/api-client-library/python/start/installation
有一个专为 App Engine 下载,其中包含所有客户端库代码和依赖项,只需将该文件解压缩到您的项目中即可。
关于google-app-engine - GAE 不导入 gflags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13547912/