【发布时间】:2018-04-28 11:51:32
【问题描述】:
我正在尝试将 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,因此认为它可能只是由于其他原因而被赶上的第一件事。
【问题讨论】:
-
您确定在您的要求中需要
anacond-client吗?你的应用用它做什么? -
我不需要它,但 pip freeze
-
当我在 requirements.txt 中删除对 anacond-client 的引用时,它仍然显示相同的错误
-
您在推送之前是否提交了对需求的更改?他们依赖于 anaconda-client 的要求中是否还有其他内容?
-
如果你使用 pip freeze > requirements.txt 和一个单独的 conda env,它会在文件中放入一些依赖项,当你推送到 Heroku 时会失败。您可以在 requirements.txt 中单独删除不必要的依赖项,或者从 Heroku 文档中的修剪版本开始:devcenter.heroku.com/articles/python-pip