在Heroku中找不到满足要求的tensorflow==1.0.0版本。

4
我正在使用Heroku云平台部署一个Django项目。我已经在requirements.txt文件中添加了所有依赖项。然而,当我将代码推送到Heroku主分支时,出现了以下错误:
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 v1.10和Python 2.7。 我可能做错了什么?

1个回答

3
您可以使用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

Wheelseggs是Python代码的打包格式。 Wheels旨在取代较旧的egg格式,并且通常更加灵活,因为它们不需要编译器(在部署到PaaS(如Heroku,Microsoft的Azure)时非常有用)。

关于wheels的一件事是命名约定,它反映了它们适用的架构和Python版本。通过以下方式快速找到系统支持的wheel类型:

import pip
print(pip.pep425tags.get_supported())

这是怎么回事?你能解释一下吗?另外,谢谢,它起作用了 :-) - LoremIpsum
在答案中添加了信息。你得喜欢一种可以将车轮与鸡蛋进行比较的语言 :) - Adrian Ghiuta

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接