Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python连接到google数据存储_Python_Export_Google Cloud Datastore - Fatal编程技术网

从Python连接到google数据存储

从Python连接到google数据存储,python,export,google-cloud-datastore,Python,Export,Google Cloud Datastore,可能重复: 我正在学习helloworld教程,无法从Python连接 这是app.yaml文件: application: "ceemee11111" version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: helloworld.app builtins: - remote_api: on 这是helloworld.py的开始: import cgi im

可能重复:

我正在学习helloworld教程,无法从Python连接

这是app.yaml文件:

application: "ceemee11111"
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:


- url: /.*
  script: helloworld.app

builtins:
- remote_api: on
这是helloworld.py的开始:

import cgi
import datetime
import urllib
import webapp2

from google.appengine.ext import db
from google.appengine.api import users


class Greeting(db.Model):
      """Models an individual Guestbook entry with an author, content, and date."""
      author = db.StringProperty()
      content = db.StringProperty(multiline=True)
      date = db.DateTimeProperty(auto_now_add=True)
在pythonshelli中,chdir到helloworld 导入helloworld

并获取导入错误“没有名为webapp2的模块”

该应用程序在localhost和ceemee1111.appspot.com中运行,没有错误。 作为一个测试,我注释掉了“importwebapp2”,然后再试一次,结果出现了一个错误 “没有名为google.appengine.ext的模块”

请提出一些想法


applicaton

python似乎找不到库,所以

  • 系统中是否安装了webapp2?。您可以尝试使用“pip安装webapp2”或“轻松安装”

  • 如果它们仍然丢失,也许您应该检查“PYTHONPATH”变量,以检查python在哪里查找库,并将您的添加到路径中


python似乎找不到库,所以

  • 系统中是否安装了webapp2?。您可以尝试使用“pip安装webapp2”或“轻松安装”

  • 如果它们仍然丢失,也许您应该检查“PYTHONPATH”变量,以检查python在哪里查找库,并将您的添加到路径中


我认为如果该应用程序在localhost和appspot.com上运行,那么这些模块将可用。webapp2不在python的可用模块中,因此我将尝试安装它。我已在python的模块中安装了webapp2,并再次运行import helloworld,并获得“import error:no module named webob”(导入错误:没有名为webob的模块),对于一个基本过程来说,这似乎非常复杂。我所需要的就是对google数据存储进行put()和fetch()访问,以获取和检索数据。有没有一个更简单的方法可以做到这一点。好了,这已经开始有意义了。google有自己的模块/lib,python有自己的模块/lib。我已经安装了pip,我可以转到google/lib运行$pip freeze-E[env1]>requirements.txt,然后转到python/lib运行$pip install-E[env2]吗-r/path/to/requirements.txt如果是的话,那么/path/to/requirements.txt我所要做的就是在path变量中添加c:\....\google\u appengine以使用google lib而不是python lib。我认为如果应用程序在localhost和appspot.com上运行,那么这些模块将可用。webapp2不在python的可用模块中,因此我将尝试安装它。我已在python的模块中安装了webapp2,并再次运行import helloworld,并获得“import error:no module named webob”(导入错误:没有名为webob的模块),对于一个基本过程来说,这似乎非常复杂。我所需要的就是对google数据存储进行put()和fetch()访问,以获取和检索数据。有没有一个更简单的方法可以做到这一点。好了,这已经开始有意义了。google有自己的模块/lib,python有自己的模块/lib。我已经安装了pip,我可以转到google/lib运行$pip freeze-E[env1]>requirements.txt,然后转到python/lib运行$pip install-E[env2]吗-r/path/to/requirements.txt如果是这样的话,那么/path/to/requirements.txt我所要做的就是将c:\....\google\u appengine添加到path变量中,以使用google lib而不是python lib