【问题标题】:Requested runtime (python-) is not available for this stack (heroku-20)请求的运行时 (python-) 不适用于此堆栈 (heroku-20)
【发布时间】:2021-01-19 18:58:11
【问题描述】:

我一直试图通过 Heroku 部署这个 Flask 应用程序。我已经研究了多种方法来解决它,但似乎无法找到它的工作方式。这是我推送到git push heroku master时得到的结果

remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote:  !     Requested runtime (python-) is not available for this stack (heroku-20).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.

我已经清除并设置了构建包,目前是:

=== wonders141 Buildpack URL
heroku/python

runtime.txt 包含:

python-3.9.1

我不确定为什么错误消息没有定义 python 版本,所以我不知道该怎么做。

【问题讨论】:

  • 我也有同样的问题不知道怎么解决!

标签: python heroku


【解决方案1】:

这可能是一个迟到的答案,但您必须在 runtime.txt 中 python-3.9.6 之后使用换行符

【讨论】:

    【解决方案2】:

    heroku stack 20 不支持您的 python 版本 - 并确保您的运行时 python 版本为小写 - 见下文

    【讨论】:

    【解决方案3】:

    我想出了如何克服这个问题。我已经清除了 requirements.txt 中的所有内容,只留下了我需要的包。显然包含了很多不必要的包。

    【讨论】:

    • 你能在这里表现得更有表现力吗? requirements.txt 与您的运行时有什么关系?您/Heroku 是否说您列表中的某些内容与规定的运行时不兼容?首先,您是如何在您的请求文本中获得“不必要的”包的?您如何确定哪些是“不必要的”?
    • 我基本上是按照这篇文章 [这里] (boscacci.medium.com/…)。简而言之,我创建了一个新的虚拟环境并使用了“pip freeze > requirements.txt”。我不能确定我是否丢失了包裹或是否有干扰 Heroku 的包裹。此外,@Nahidujjaman 有一个我可以确认的答案。它甚至可以在运行时使用我的 python-3.9.1 运行。
    猜你喜欢
    • 2019-09-13
    • 1970-01-01
    • 2021-12-12
    • 2019-07-17
    • 2021-01-10
    • 2019-08-08
    • 1970-01-01
    • 2017-08-04
    相关资源
    最近更新 更多