我正在尝试将 Django 应用程序推送到 Heroku,但在运行时出现以下错误 git push heroku master
:
Counting objects: 80, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (80/80), 990.21 KiB | 0 bytes/s, done.
Total 80 (delta 20), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! The latest version of Python 2 is python-2.7.14 (you are using
python-2.7.12, which is unsupported).
remote: ! We recommend upgrading by specifying the latest version
(python-2.7.14).
remote: Learn More: https://devcenter.heroku.com/articles/python-
runtimes
remote: -----> Installing python-2.7.12
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: Collecting alabaster==0.7.7 (from -r
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 1))
remote: Downloading alabaster-0.7.7-py2.py3-none-any.whl
remote: Collecting anaconda-client==1.4.0 (from -r
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2))
remote: Could not find a version that satisfies the requirement
anaconda-client==1.4.0 (from -r
/tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2)) (from
versions: 1.1.1, 1.2.2)
remote: No matching distribution found for anaconda-client==1.4.0 (from
-r /tmp/build_a1f6d188f9e0e61e01076a73d4e10542/requirements.txt (line 2))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to demo-freshstart.
似乎它与 Anaconda 有关,但我很早就在我的 requirements.txt 中看到了 Anaconda,所以认为它可能只是因为其他原因而被赶上的第一件事。
原文由 user3294779 发布,翻译遵循 CC BY-SA 4.0 许可协议
对于每条消息
你得到的,你必须手动做:
1 - 在
requirements.txt
行,其中 X 出现,删除==<version number>
2 - 保存文件
3 - 提交
4 - 推
对提示报告的下一个错误再次执行此操作,直到到达
requirements.txt
中包含的列表的末尾。(如果您的 X 是
psycopg2
,请将其替换为psycopg2-binary
)。通过安装和运行 pip-chill 可以获得相同的结果
注意: 这是最后的资源解决方案,因此,在实施之前,请按照 此答案 的说明查看是否可以解决问题