【问题标题】:GCP could not find flask when it is present in lib folder当 lib 文件夹中存在烧瓶时,GCP 找不到烧瓶
【发布时间】:2019-05-03 11:43:32
【问题描述】:

我正在尝试按照标准指南将 python 烧瓶应用程序部署到 GCP,我已使用命令将 requirements.txt 安装到 lib 文件夹

 pip install -t lib -r requirements.txt

但服务器在运行时因烧瓶模块的 ImportError 而失败,这在本地和云上都发生了,即使用

dev_appserver.py  app.yaml #locally
gcloud app deploy # On cloud

但是当我打开 lib 文件夹时,我可以看到那里的依赖关系

这是我的 requirements.txt 的样子

requests>=2.19.1
pandas==0.20.3
python-telegram-bot==11.1.0
Quandl>=3.4.0
redis
stockstats==0.2.0
flask
flask-socketio
python-socketio
flask-login

【问题讨论】:

标签: python google-app-engine google-cloud-platform pip


【解决方案1】:

1 - 你有文件appengine_config.py

以下两行:

from google.appengine.ext import vendor
vendor.add('lib')

https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27

2 - 你的lib 文件夹中是否有__init__.py

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-18
    • 2014-09-22
    • 1970-01-01
    • 2022-09-28
    • 2021-11-01
    相关资源
    最近更新 更多