python - Tensorflow 2.0 未使用 Heroku 在 pipenv 上安装
问题描述
我使用 tf 为 django 工作了 pipenv 锁,但它不会继续安装在 heroku 服务器上。
An error occurred while installing tensorflow==2.0.0! Will try again.
我希望服务器可以安装 2.0 tensorflow,但它失败了并且没有事先帮助。
dj-database-url = "==0.5.0"
django-storages = "==1.7.1"
django = "==2.1.5"
gunicorn = "==19.9.0"
psycopg2-binary = "==2.7.6.1"
psycopg2 = "==2.7.6.1"
markdownify = "==0.4.1"
numpy = "==1.16.2"
pipenv = "*"
regex = "==2017.4.5"
tensorboard = "*"
tb-nightly = "==1.14.0a20190301"
tf-estimator-nightly = "==1.14.0.dev2019030115"
tensorflow = "*"
tensorflow-estimator = "*"
Keras-Applications = "*"
Keras-Preprocessing = "*"
本地机器安装tensorflow到2.0.0但是heroku机器需要2.0.0a0或者b0或者b1,不会在本地安装。
pipenv install tensorflow -v
提出:
requires absl-py>=0.7.0, astor>=0.6.0, gast==0.2.2, google-pasta>=0.1.6, grpcio>=1.8.6, keras-applications>=1.0.8, keras-preprocessing>=1.0.5, numpy<2.0,>=1.16.0, opt-einsum>=2.3.2, protobuf>=3.6.1, six>=1.10.0, tensorboard<2.1.0,>=2.0.0, tensorflow-estimator<2.1.0,>=2.0.0, termcolor>=1.1.0, wheel>=0.26, wrapt>=1.11.1
这适合已安装的软件包,但设置为 2.0.0,而不是 a0、b0 或 b1。
Could not find a version that satisfies the requirement tensorflow==2.0.0 (from -r /tmp/pipenv-0_4yw8_o-requirements/pipenv-d2wfuv4u-requirement.txt (line 1)) (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1)
所需的软件包是:
absl-py = "==0.7.1"
astor = "==0.7.1"
gast = "==0.2.2"
protobuf = "*"
six = "==1.12.0"
termcolor = "==1.1.0"
解决方案
TensorFlow 仅支持从 python 3.4 到 python 3.7(截至 2020 年 3 月)。您可以在文档的 [系统要求页面][1] 中找到更多信息。
确保在您的 Pipfile 中有以下内容:
[requires]
python_version = "3.7"
如果不是这种情况,请删除虚拟环境,将其更改python_version
为正确的并重新创建环境。
我希望它有帮助!
推荐阅读
- python - 循环脚本以生成多个图像
- azure - 通过 Azure AD B2C 中的资源所有者密码凭据流出现 404 Not Found 错误
- vba - 将word文档插入另一个word文档而不更改格式VBA
- javascript - 循环遍历数组和相关元素
- javascript - 根据javascript中输入的值向元素添加和删除类(无jquery)
- java - 井字游戏没有输出?
- javascript - 如何在 Class 组件的函数中使用 React Context
- javarosa - 从选定日期自动生成周数
- string - sed 复杂字符串(单引号和双引号 & / 空格...)
- go - 在 Golang 中将可变大小的 []byte 转换为 int64