python - 模块未找到错误: No module named 'tensorflow.compiler'

标签 python python-3.x tensorflow google-cloud-tpu

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\contrib\tpu\python\tpu\tpu_estimator.py in <module>()
     38 from tensorflow.contrib.tpu.python.tpu import tpu_config
     39 from tensorflow.contrib.tpu.python.tpu import tpu_context
---> 40 from tensorflow.contrib.tpu.python.tpu import tpu_feed
     41 from tensorflow.contrib.tpu.python.tpu import training_loop
     42 from tensorflow.contrib.tpu.python.tpu import util as util_lib

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\contrib\tpu\python\tpu\tpu_feed.py in <module>()
     26 from six.moves import xrange  # pylint: disable=redefined-builtin
     27 
---> 28 from tensorflow.compiler.xla.experimental.xla_sharding import xla_sharding
     29 from tensorflow.compiler.xla.python_api import xla_shape
     30 from tensorflow.contrib.tpu.python.ops import tpu_ops

ModuleNotFoundError: No module named 'tensorflow.compiler'

当我运行以下代码时出现上述错误: 环境:windows10+jupyter笔记本+tensorflow1.9+python3.6

import tensorflow as tf
x_image = tf.reshape(x, [-1,24,24,3])
h_conv1 = tf.contrib.layers.conv2d(x_image, 64,5,1, "SAME", 
activation_fn=tf.nn.relu)

最佳答案

如果 Tensorflow 安装不完整(例如“pip install tensorflow”已中断),则可能会发生此错误。

关于python - 模块未找到错误: No module named 'tensorflow.compiler' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51909312/

相关文章:

python - 403 禁止使用 Urllib2 [Python]

python - PyQt5 QScrollArea 不滚动,而是调整项目大小

python - 类型错误 : Input 'y' of 'Mul' Op has type float32 that does not match type float64 of argument 'x'

python - 为什么 __init__() 缺少参数?

python - 在 IPython 模式下更改 Emacs “send code to interpreter” C-c C-r 命令

python - 使用 python 在 Mac 上监视全局键盘输入

python - Tensorflow 将训练数据分成批处理

python - Unpickle具有向后兼容性的namedtuple(忽略附加属性)

python - Python 中的简单合并排序错误

python - 如何在 tensorflow 急切执行模式下打印纯文本常量