Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?

如果你的Tensorflow程序很简单,比如这样:

Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?

那么出现AttributeError: module 'tensorflow' has no attribute 'constant'的原因是:

该文件命名错误,不要用tensorflow.py这个名字,换个别的就好了Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?Tensorflow出现AttributeError: module 'tensorflow' has no attribute 'constant'问题怎么办?