首页 > 解决方案 > Heroku 在 requirements.txt 中找不到分布

问题描述

我正在尝试使用 Heroku 部署我的第一个 Python Telegram 机器人,但是当我这样做时会出现两个错误:

ERROR: Could not find a version that satisfies the requirement pornhub-api==0.2.0
ERROR: No matching distribution found for pornhub-api==0.2.0

pornhub-api模块不支持还是什么?我对 Python 很陌生,如果我问一些愚蠢的问题,我很抱歉,但我找不到任何可以帮助我的东西。

requirements.txt文件如下所示:

telepot==12.7
pornhub-api==0.2.0

谢谢!

出现错误的所有过程:

Python app detected
Requirements file has been changed, clearing cached dependencies
Installing python-3.6.10
Installing pip
Installing SQLite3
Installing requirements with pip
   Collecting telepot==12.7
     Downloading telepot-12.7.tar.gz (73 kB)
   ERROR: Could not find a version that satisfies the requirement pornhub- 
 api==0.2.0 (from -r 
/tmp/build_"here the is written the build number"/requirements.txt (line 2)) (from 
versions: none)
   ERROR: No matching distribution found for pornhub-api==0.2.0 (from -r 
/tmp/build_"here the is written the build number"/requirements.txt (line 2))
!     Push rejected, failed to compile Python app.
!     Push failed

标签: pythonheroku

解决方案


您似乎使用的是 Python 3.6,而该库说它需要 3.7 或更高版本:

Installing python-3.6.10

您应该能够通过在存储库的根目录中添加一个包含所需版本、提交并再次部署的文件来请求更新的运行时。runtime.txt

目前,Heroku 支持Python 版本

  • 3.8.3
  • 3.7.7
  • 3.6.10
  • 2.7.18

如果您想使用 Python 3.8.3(如果可以,为什么不使用最新的?)您runtime.txt应该包含以下内容:

python-3.8.3

推荐阅读