python - 为什么我会收到 Tensorflow Serving 模块导入错误?

标签 python tensorflow tensorflow-serving

我正在尝试使用 TensorFlow Serving。我用 these 安装了 TensorFlow 服务说明。

当我尝试在我的 python 代码中使用这一行时

from tensorflow_serving.session_bundle import exporter

我遇到了这个问题

>>> from tensorflow_serving.session_bundle import exporter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow_serving.session_bundle

为什么我会遇到这个问题?我是否缺少构建 TensorFlow 以包含此模块的内容?

附言:Hello World TensorFlow 应用程序在我的设置中运行良好。

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

最佳答案

在花了无数个小时之后,我设法找到了解决方案。

当我换行的时候

from tensorflow_serving.session_bundle import exporter

from tensorflow.contrib.session_bundle import exporter

TF 开发人员似乎决定更改源代码树中的 session_bundle 包位置。

关于python - 为什么我会收到 Tensorflow Serving 模块导入错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43837577/

相关文章:

python - 仅使用 python 的 New-PSSession(无子进程模块)

python - 将权重从一个 Conv2D 层复制到另一层

python - 裁剪图像为3D阵列

python - 在用于服务模型的 Tensorflow 中,服务输入函数应该做什么

tensorflow - tensorflow 图在什么阶段建立?

python - tkinter - 加权 Canvas 不填充空白空间

python - 使用 glob 匹配以数字和下划线开头的文件

生成 tf.record 文件时出现 Python 错误 - Tensorflow.python.framework.errors_impl.NotFoundError : No such file or directory

python - TensorFlow:如何从 SavedModel 进行预测?

python - python 中进行敏感性分析的 SAlib 库出错