我正在尝试使用 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/