【问题标题】:Issues with deploying Flask app to Google App Engine - Error Messages将 Flask 应用程序部署到 Google App Engine 的问题 - 错误消息
【发布时间】:2022-01-01 19:14:42
【问题描述】:

我对云服务非常陌生,目前正在从事一个个人项目,以在 Google App Engine 上部署聊天机器人网络应用程序。当我在 Cloud Shell 终端上运行命令 gcloud app deploy 时,我不断收到以下错误消息:

Step #1: ERROR: Could not find a version that satisfies the requirement Python==3.7.3 (from -r requirements.txt (line 3)) (from versions: none)
Step #1: ERROR: No matching distribution found for Python==3.7.3 (from -r requirements.txt (line 3))
Step #1: WARNING: You are using pip version 20.2.2; however, version 21.3.1 is available.
Step #1: You should consider upgrading via the '/env/bin/python -m pip install --upgrade pip' command.
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud-builders/docker@sha256:xxxx" failed: step exited with non-zero status: 1

这是我的 requirements.txt 文件中的内容:

Flask==1.1.2
Werkzeug==1.0.1
Python==3.7.3
gunicorn==20.0.4

这就是我的 app.yaml 中的内容:

runtime: python
env: flex
runtime_config:
        python_version: 3

api_version: 1
threadsafe: true
entrypoint: gunicorn -b :$PORT main:app

不知道这些错误是怎么回事,因为我已经尝试安装最新版本的 pip 和 Python 3.7.3。

【问题讨论】:

  • 你不应该在requirements.txt 中提及python,它只是为了保留使用pip 安装的所有外部依赖项。因此,只需从需求文件中删除 Python==3.7.3

标签: python google-app-engine


【解决方案1】:

删除 Python==3.7.3 应该可以解决您的问题。

您也可以使用此命令而不是自己编写它以避免任何错误pip install -r requirements.txt。你可以在installing dependencies locally获得更多信息。

【讨论】:

    猜你喜欢
    • 2014-01-20
    • 2020-11-24
    • 1970-01-01
    • 2019-04-22
    • 1970-01-01
    • 2020-01-13
    • 2023-03-10
    • 1970-01-01
    • 2016-09-15
    相关资源
    最近更新 更多