You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Heroku部署Python应用提示与buildpack不兼容,文件齐全仍报错如何解决

Heroku Python应用buildpack不兼容报错解决方案

报错信息:App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz

按以下顺序排查解决:

  • 检查应用绑定的buildpack是否正确
    执行命令heroku buildpacks查看当前绑定的buildpack列表,若不存在heroku/python,执行heroku buildpacks:set heroku/python手动绑定官方Python buildpack。
  • 确认依赖文件已提交到git仓库
    执行git ls-files检查git跟踪的文件列表,确认根目录下的requirements.txt、Procfile、manage.py都在列表中。如果缺失,执行:
    git add requirements.txt Procfile manage.py
    git commit -m "add required deployment files"
    
  • 检查Python版本兼容性
    若项目根目录存在runtime.txt,确认文件内指定的Python版本属于Heroku官方支持的版本范围(当前支持3.8、3.9、3.10、3.11分支的正式版本),不支持的旧版本会触发buildpack兼容报错。
  • 检查目录结构是否符合要求
    确保requirements.txt直接存放在git仓库的根目录,而非嵌套在子文件夹中,Heroku的Python buildpack仅会扫描仓库根目录的依赖文件识别项目类型。
  • 清理部署缓存后重试
    执行heroku builds:cache:purge清理历史构建缓存,再执行git push heroku main重新提交部署。

内容的提问来源于stack exchange,提问作者Farrukh Nadeem

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.05 01:57:01