找不到时间 Heroku 的匹配分布

No matching distribution found for time Heroku

我试图将 python 脚本部署到使用 Python 中的 time 模块的 Heroku。我将 time 模块放在 requirements.txt 中,Heroku 尝试收集它,但出现此错误:

No matching distribution found for time

为什么会发生这种情况,我该如何解决?

Time 是一个已包含在 python 中的模块。这就是为什么您不能使用 pip 安装模块 "time" 的原因。因此,如果您不将其包含在 requirements.txt 中,它将正常工作。由于 Heroku 有 python 版本,因此也有你需要的时间模块。

确保阅读 python 的文档:https://docs.python.org/3/library/time.html

I put the time module in requirements.txt

不要那样做。

time 是 Python 标准库的一部分;它带有 Python 并且自动可用。

requirements.txt 仅适用于第三方模块。从您的 requirements.txt 中删除 time,提交并重新部署。