安装好tensorflow2.0之后,当使用tensorflow时,报错AttributeError: module 'tensorflow' has no attribute '__version__'
错误信息:
AttributeError: module 'tensorflow' has no attribute '__version__'
错误的意思是tensortflow模块没有__version__属性,后来查阅资料发现,tensorflow2.0版本中的确没有__version__这个属性,如果安装的是tensorflow2.0版本又想利用__version__属性,在引用tensorflow时,直接用:
import tensorflow.compat.v1 as tf
1 |