【发布时间】:2017-06-24 07:03:45
【问题描述】:
目标:将 GAE 与 Python 和 Google Cloud Storage 结合使用,以更有效地存储和提供图像,最终使用图像 API。
问题:尽管安装成功,但找不到正确的模块(httplib2 和 6)。
运行时示例
Python 代码示例 A:
from google.cloud import storage
from google.appengine.api import app_identity
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
import webapp2
返回样本 A:
ImportError: 没有名为 google_auth_httplib2 的模块
注意:六个也有类似的错误。 “没有名为 6 的模块”
安装详情
python 安装在:
C:\Python27
六个安装在:
C:\python27\lib\site-packages\six-1.10.0-py2.7.egg
httplib2 安装在:
C:\Python27\Lib\site-packages\httplib2-0.9.2-py2.7.egg-info
在命令行中运行“C:>pip install httplib2”返回:
“Requirement already satisfied: httplib2 in c:\python27\lib\site-packages”
在命令行中运行“C:>pip install 6”返回:
Requirement already satisfied: six in c:\python27\lib\site-packages\six-1.10.0-py2.7.egg
GAE 云存储客户端安装在:
C:\Python27\Lib\site-packages\GoogleAppEngineCloudStorageClient-1.9.22.1-py2.7.egg-info
GAE SDK 服务器托管使用“dev_appserver.py”。在:
C:\Users\sebastian\Documents\Web Projects\Cookbook
此位置还包含 app.yaml 文件。
将模块复制到 app.yaml 位置
将httplib2 和six-1.10.0-py2.7.egg 文件夹复制到我的app.yaml 目录。
附录 1:
App.yaml
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
script: homegcs.app
- url: /static
static_dir: static
- url: /.*
script: home.app
- url: /index\.html
script: home.app
- url: /stylesheets
static_dir: stylesheets
- url: /(.*\.(gif|png|jpg))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg)$
- url: /admin/.*
script: admin.app
login: admin
- url: /.*
script: not_found.app
【问题讨论】:
标签: python-2.7 google-app-engine google-cloud-storage httplib2 six