1.问题引出
一套基于tensorflow框架的python 代码在linux系统下(python2.7+tensorflow1.7.0)运行良好,但在windows系统下(anaconda4.3.30+python3.5+tensorlow1.7.1)各种报错:
AttributeError: module ‘tensorflow.python.training.checkpointable’ has no attribute ‘CheckpointableBase’
首先根据报错,排除python解释器不兼容这个原因。那么就是tensorflow包的原因,但是tensorflow1.7.1应该是兼容tensorflow1.7.0的,这就很奇怪了。
2.问题原因
原来是因为我的之前安装过tensorflow1.12.0的包,没有清理干净,导致其他包夹杂在一起造成的。
3.解决方案
先删除1.7.0之后的包,在安装它。
如果你是用的anaconda来安装python 记得先激活环境
激活环境:
activate yourenvsname(你的环境名字)
在执行下面命令:
pip uninstall “tensorflow1.7.*"
pip install --upgrade "tensorflow1.7.*”
参考文章