我试着用在个人项目中使用Datastore。不过,无论我多么努力,都无法导入数据存储模块。
我一直在使用在线控制台(为了避免先在我的PC上解决问题,然后在GCloud上解决问题.)
所以,我用
from google.cloud import datastore
不幸的是,这根本行不通。我的最后一个错误是
ImportError: No module named google.protobuf
但在我有像Can't import Datastore.
这样的东西之前
我所做的就是消除/lib的完整性,用pip重新安装每个依赖项。这是我的requirements.txt
# This requirements file lists all third-party dependencies for this project.
#
# Run 'pip install -r requirements.txt -t lib/' to install these dependencies
# in `lib/` subdirectory.
#
# Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
Flask==0.10
google.cloud==0.25.0
protobuf==3.3.0
(添加最后一行是为了解决我得到的最后一个错误)。在发生这个错误之前,我得到
另外,还有一个澄清的问题:我看到(在寻找答案的时候)有人使用gcloud
,有些人使用google.cloud
。有什么关系呢?我该用什么?
而且,pip show google.cloud
什么也没有显示。
我遗漏了什么?
谢谢
发布于 2017-05-15 21:01:00
如果有人想知道我是怎么解决这个问题的。修正之处在于将瓶装版本改为0.12 (不知道原因,但事实就是如此)。
我删除了lib
以确定我是从零开始的。然后,我使用了这个requirements.txt
文件:
Flask==0.12
google-cloud==0.25.0
click==5.1
(click
为瓶0.12所需)。
https://stackoverflow.com/questions/43962120
复制相似问题