[英]Tensorflow: AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops'
I'm using keras ver 1.0.8
and tensorflow ver 0.12.0
.我正在使用 keras 版本1.0.8
和 tensorflow 版本0.12.0
。 I ran python image_zooms_training.py -n 0
then it throws我跑了python image_zooms_training.py -n 0
然后它抛出
`AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops' `AttributeError:模块'tensorflow.python'没有属性'control_flow_ops'
please tell me how to solve .请告诉我如何解决。 thank you for your help.感谢您的帮助。
Following import works.以下进口作品。 You need to update that line您需要更新该行
from tensorflow.python.ops import control_flow_ops
Official TensorFlow Support discourages use of tf.python.* as it is private and intended for development purposes only.官方 TensorFlow 支持不鼓励使用 tf.python.*,因为它是私有的并且仅用于开发目的。 While it may work in some cases, it will "break unannounced" in many others.虽然它在某些情况下可能有效,但在许多其他情况下它会“突然中断”。
Instead, try importing tensorflow with the .python portion removed, eg:相反,请尝试在删除 .python 部分的情况下导入 tensorflow,例如:
from tensorflow.keras.models import Sequential
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.