我正在使用 heroku 云平台部署一个 django 项目。我在 requirements.txt 文件中添加了依赖项。但是,当我推送到 heroku master 时,出现以下错误:
Collecting tensorflow==1.0.0 (from -r /tmp/build_bc8be989466414998410d3ef4c97a115/requirements.txt (line 17))
remote: Could not find a version that satisfies the requirement tensorflow==1.0.0 (from -r /tmp/build_bc8be989466414998410d3ef4c97a115/requirements.txt (line 17)) (from versions: )
remote: No matching distribution found for tensorflow==1.0.0 (from -r /tmp/build_bc8be989466414998410d3ef4c97a115/requirements.txt (line 17))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to what-the-image.
remote:
我使用的是 Django v 1.10 和 python 2.7。我哪里会出错?
最佳答案
您将能够使用 wheel 在 Heroku 上安装 Tensorflow .
只需将 requirements.txt 中的 tensorflow==1.0.0
行替换为 https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0 -cp27-none-linux_x86_64.whl
Wheels和 eggs是 Python 代码的打包格式。 Wheels 旨在取代旧的 egg 格式,并且通常更加通用,因为它们不需要可用的编译器(在部署到 PaaS 时非常有用,例如 Heroku、Microsoft 的 Azure)。
关于轮子需要注意的一件事是 naming convention ,它反射(reflect)了它们打算使用的体系结构和 Python 版本。查找系统支持的车轮类型的快速方法是:
import pip
print(pip.pep425tags.get_supported())
关于python - 在 Heroku 中找不到满足 tensorflow==1.0.0 要求的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42328863/