Skip to main content
 首页 » 编程设计

python之请求的运行时 (ÿþpython-3.6.5) 在 Heroku 上不适用于此堆栈

2025年05月04日13xiaohuochai

我今天将python版本从3.6.4更新到3.6.5。这是因为在分发到Heroku的过程中,它推荐的版本是3.6.5。因此,确认了以下power shell内容。

Writing objects: 100% (35/35), 11.68 KiB | 0 bytes/s, done. 
Total 35 (delta 3), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: -----> Python app detected 
remote:  !     The latest version of Python 3 is python-3.6.5 (you are using ÿþpython-3.6.5, which is unsupported). 
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.5). 
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes 
remote: -----> Installing ÿþpython-3.6.5 
remote:  !     Requested runtime (ÿþpython-3.6.5) is not available for this stack (heroku-16). 
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support 
remote:  !     Push rejected, failed to compile Python app. 
remote: 
remote:  !     Push failed 
remote: 
remote: !       Push rejected to XXXXXXXX. 
remote: 
To https://git.heroku.com/XXXXXXXX.git 
 ! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/XXXXXXXX.git 

将我的 runtime.txt 文件更改为 UTF-8 后,我现在收到以下错误:

Writing objects: 100% (35/35), 11.68 KiB | 0 bytes/s, done. 
Total 35 (delta 3), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: -----> Python app detected 
remote:  !     The latest version of Python 3 is python-3.6.5 (you are using python-3.6.5, which is unsupported). 
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.5). 
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes 
remote: -----> Installing python-3.6.5 
remote:  !     Requested runtime (python-3.6.5) is not available for this stack (heroku-16). 
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support 
remote:  !     Push rejected, failed to compile Python app. 
remote: 
remote:  !     Push failed 
remote: Verifying deploy... 
remote: 
remote: !       Push rejected to XXXXXXXX. 
remote: 
To https://git.heroku.com/XXXXXXXX.git 
 ! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/XXXXXXXX.git 

为什么 python-3.6.5 被拒绝了?这不正是 Heroku 所说的默认版本吗?

请您参考如下方法:

Heroku 认为您的 runtime.txt 包含一些额外的字符:

ÿþpython-3.6.5 

这可能是 byte-order mark for a file encoded as UTF-16 in little-endian order .确保您对该文件(和其他文件)使用合理的编码。 UTF-8 几乎在所有情况下都是不错的选择。