首页 > 解决方案 > Heroku push:“Git push Heroku master”和“Buildpack”失败-> Python

问题描述

我真的搞砸了这个问题......我已经在寻找合适的解决方案,但到目前为止没有任何效果。所以,我希望有人能给我一个提示!

我已经手动将 Buildpack 设置为 python!但他不会接受.../python.gtz。谢谢!

(venv) jpt@MacBookProJT95 SMA % git push heroku master:main        
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 4 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (16/16), 2.95 KiB | 1.47 MiB/s, done.
Total 16 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: dc06a64ffe6a009a19697612b27abbb653ef757d
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version dc06a64ffe6a009a19697612b27abbb653ef757d
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to first-murmeltier.
remote: 
To https://git.heroku.com/first-murmeltier.git
 ! [remote rejected] master -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/first-murmeltier.git'

标签: python-3.xherokugit-push

解决方案


我将所需的 python 版本定义为“Python 3.6.x”——但它必须是“Python-3.6.x”(破折号是关键!)

这就是“指定 Python 运行时”在指定 Python 版本中确实记录的内容:

默认情况下,新创建的 Python 应用程序使用 python-3.9.6 运行时。
您还可以指定不同的受支持的 Python 版本。

支持的运行时

  • 所有支持的堆栈上的 python-3.9.6
  • 所有支持的堆栈上的 python-3.8.11
  • 所有支持的堆栈上的 python-3.7.11
  • 所有支持的堆栈上的 python-3.6.14

并且,如此处所示,确保runtime.txt正确编码。


推荐阅读