Heroku推送错误怎么办?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (263)

我有一个问题是将我的python代码发布到heroku请记住这是我在heroku上的第一个项目,首先是与存储库有关:

Counting objects: 18, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (18/18), 21.80 KiB | 0 bytes/s, done.
Total 18 (delta 2), 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.5 (you are using python-3.6, which is unsupported).
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.5).
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.6
remote:  !     Requested runtime (python-3.6) 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 project.
remote:
To https://git.heroku.com/project.git
 ! [remote rejected] master -> master (pre-receive hook declined)

报错:无法将某些引用推送到“https://git.heroku.com/project.git”

提问于
用户回答回答于

你的requirements.txt文件必须包含python-3.6.5所有小写字母和 - 符号很重要

用户回答回答于

试试这个:

pipenv lock
git add. 
git commit -am "make it better"
git push heroku master

如果你想要一个不同的版本,编辑新文件并输入以下信息:[requires] python_version =“2.7”或[requires] python_full_version =“2.7.15”

扫码关注云+社区

领取腾讯云代金券