Heroku推送被拒绝,错误说python 2.7.14不受支持,即使它是

时间:2018-03-08 20:51:48

标签: python heroku

我创建了一个互动的散景图,我试图与Heroku一起服务。我使用Python"浏览了#34; Heroku入门。教程,我也关注this example。使用适当的Procfile设置,我可以在本地运行Heroku应用程序。我已将runtime.txt和Pipfile中的Python版本指定为2.7.14,这也是我的本地版本。但是当我尝试推送到Heroku服务器时,我收到以下错误消息

remote: -----> Python app detected
remote:  !     The latest version of Python 3 is python-3.6.4 (you are using # runtime.txt
remote: python-2.7.14, 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 # runtime.txt
remote: python-2.7.14
remote:  !     Requested runtime (# runtime.txt
remote: python-2.7.14) 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

Heroku docs(在错误消息中给出的链接!)说事实上支持Python 2.7.14。我在这里缺少什么东西,就像我需要指定python版本的其他地方一样?

我的完整代码为here以供参考。

编辑:当我的意思是Pipfile时,我写了Procfile。

2 个答案:

答案 0 :(得分:0)

你应该在Pipfile中指定python版本。来自他们的网站

  

如果您愿意,可以使用Pipfile

指定运行时python-2.7.14
$ cat Pipfile

[requires]
python_full_version = "2.7.14"

答案 1 :(得分:0)

Thanks to some help on Twitter, I've found the answer. I didn't need to define the python version in both Pipfile AND runtime.txt. I had tried to just have runtime.txt and got the same result, but having just the Pipfile definition let me push to Heroku and the build was successful.