【问题标题】:Failed for buildpack构建包失败
【发布时间】:2020-02-19 14:27:38
【问题描述】:

我正在尝试在我的 heroku 上运行一个 python 文件。我尝试不设置构建包以及设置一个,但似乎都不起作用。我的分支中唯一的文件是 .py 和 .git 文件夹 这是一个错误示例:

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 590 bytes | 590.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to google-results.
remote:

【问题讨论】:

标签: python heroku buildpack


【解决方案1】:

https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-python

您的 git 存储库中还需要以下 2 个文件:runtime.txt 和 requirements.txt

runtime.txt 负责您的程序将使用哪个 Python 版本。

cat runtime.txt
python-3.7.2

支持的 runtime.txt 版本不时更改,请查看https://devcenter.heroku.com/articles/python-runtimes

requirements.txt 需要指定您的项目所依赖的https://pypi.org/ 中的哪些库。请务必指定版本以避免损坏。
您可以使用以下命令获取当前安装的 python 库的列表:python -m pip freeze > requirements.txt

【讨论】:

    猜你喜欢
    • 2016-05-17
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多