我今天将python版本从3.6.4更新到3.6.5。这是因为,在分发给Heroku的过程中,它建议使用版本3.6.5。因此,确认了以下电源壳内容。
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所说的默认版本吗?
你是我的好帮手。谢谢大家!
答案 0 :(得分:4)
Heroku认为您的runtime.txt
包含一些额外字符:
ÿþpython-3.6.5
这可能是byte-order mark for a file encoded as UTF-16 in little-endian order。确保您对该文件(以及其他文件)使用合理的编码。几乎在所有情况下,UTF-8都是不错的选择。
答案 1 :(得分:3)
您正在尝试安装ÿþpython-3.6.5
而不是python-3.6.5
,因为控制台输出建议。删除ÿþ
,它应该按预期工作。
答案 2 :(得分:0)
不是这个!这太荒谬了! 我刚刚删除了runtime.txt文件 ... Heroku已经很好地部署了我的Django项目。当然有应用程序错误,但是......谢谢!每个人都告诉我有用的东西。顺便说一句,我仍然不知道为什么它正常部署。是否有理由删除runtime.txt文件?