在运行Tensorflow时报错:
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'
这其实不是包的安装错误,是因为在新的Tensorflow 2.0版本中已经移除了Session这一模块,改换运行代码:
sess = tf.InteractiveSession()
换成:
sess = tf.compat.v1.InteractiveSession()
同理,如果代码中还有类似的"tf.***"之类的代码,应该都要在其后加上"compat.v1."。
如果用着不习惯,那就降低Tensorflow的版本也可以:
pip install tensorflow==1.14