首页 > 解决方案 > Heroku 无法识别 Python 版本(这是必需的版本,在本例中为 3.6.4)

问题描述

我正在使用 将我的代码部署到 Heroku git push heroku master,但构建失败。这是输出:

Counting objects: 316, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (305/305), done.
Writing objects: 100% (316/316), 12.71 MiB | 915.00 KiB/s, done.
Total 316 (delta 83), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote:  !     The latest version of Python 3 is python-3.6.4 (you are using Python 3.6.4, which is unsupported).
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.4).
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing Python 3.6.4
remote:  !     Requested runtime (Python 3.6.4) is not available for this stack (heroku-16).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to greensun.
remote: 
To https://git.heroku.com/greensun.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/greensun.git'

如您所见,它说:

偏僻的: !Python 3 的最新版本是 python-3.6.4(您使用的是 Python 3.6.4,它不受支持)。

如何让 Heroku 识别 Python 3.6.4?(它已经安装在这台带有 Ubuntu 的笔记本电脑上,并且该应用程序具有runtime.txt内容:)python-3.6.4

标签: pythongitheroku

解决方案


刚刚发现此错误停止出现,因为我在 buildpacks 部分的 heroku 仪表板中将应用程序配置为 Python。


推荐阅读