【问题标题】:Requested runtime (Python-3.7.3) is not available for this stack (heroku-18)请求的运行时 (Python-3.7.3) 不适用于此堆栈 (heroku-18)
【发布时间】:2019-07-26 08:38:42
【问题描述】:

我正在使用 Django 2.2.3,但出现此错误:

Requested runtime (Python-3.7.3) is not available for this stack (heroku-18)

但是,Heroku's Python documentation 表示 python-3.7.3 应该在堆栈 heroku-18 中可用。

runtime.txt 包含Python-3.7.3

完全错误

Counting objects: 100% (43/43), done.
Delta compression using up to 4 threads
Compressing objects: 100% (36/36), done.
Writing objects: 100% (43/43), 10.70 KiB | 996.00 KiB/s, done.
Total 43 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     Requested runtime (Python-3.7.3) is not available for this stack (heroku-18).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed

【问题讨论】:

    标签: python django heroku runtime-error


    【解决方案1】:

    与 Heroku 生态系统中的几乎所有其他内容一样,runtime.txt 区分大小写。将其内容更改为

    python-3.7.3
    

    使用小写的p

    【讨论】:

      【解决方案2】:

      我发现自己在使用 Windows10 时遇到了这个错误,并试图将我的项目推送到 Heroku。我的是一个 Flask 应用程序。

      错误:

      请求的运行时 (Python-3.7.1) 不适用于此堆栈 (heroku-18)

      发生了什么? 我的机器上确实安装了 Python 3.7.1。 即使将 python-3.7.2 声明为 runtime.txt 我也有错误。

      我做了什么? 通过 powershell(以管理员身份)检查了我的 python 版本: python --version 是 3.7.1

      然后通过巧克力升级python。检查this answer

      1. choco 升级 python -y

      2. 刷新

      3. 关闭并重新打开您的代码编辑器或重新启动系统。

      再次检查了我的 python 版本:现在我有 3.8.0,这是一个受支持的堆栈。

      我确实回到了我的项目并删除了 virtualenv 文件夹(我的是 venv)。 从 venv 创建、依赖项安装和设置开始。

      将 python-3.8.0 添加到 runtime.txt 并重试整个 heroku 部署。

      瞧!

      注意:记得更新你的环境变量和python路径。

      注意 2:请让我们知道您的结果或解决方案。

      【讨论】:

        【解决方案3】:

        我认为这个heroku堆栈与这个python版本不兼容,尝试使用这个命令升级你的堆栈: heroku 堆栈:设置 heroku-20 或尝试使用此documentation 中的其他堆栈

        【讨论】:

          【解决方案4】:

          我必须从此处列出的受支持的 Python 版本中进行选择:https://devcenter.heroku.com/articles/python-support

          【讨论】:

            【解决方案5】:

            我不知道它会对你有什么帮助。我刚刚从我的 django 应用程序中删除了 requirements.txt 文件,然后 heroku 自动检测到了 python 版本,现在它可以正常工作了

            【讨论】:

            • 我不确定这是不是最好的解决方案。首先,requirements.txt 的存在是有原因的——指定运行项目所需的确切版本。删除它们可能会在此过程中搞砸其他事情。
            猜你喜欢
            • 2019-09-13
            • 1970-01-01
            • 2021-01-10
            • 2019-07-17
            • 2021-12-12
            • 2019-08-08
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多