AttributeError: module 'tensorflow' has no attribute '__version__'解决方案

最近电脑出现问题,tensorflow也总是bug连连,记录下出现的问题及解决方案。
问题:

AttributeError: module 'tensorflow' has no attribute '__version__'

总之,就是tensorflow的各种属性不能使用。
单独创建了tensorflow的虚拟环境

conda create -n tensorflow1 python=3.6
source activate tensorflow1 #开启虚拟环境
source deactivate  #关闭虚拟环境

在虚拟环境中安装tensorflow的CPU和GPU版本,在原环境中均能正确使用,但在虚拟环境中总是报错
尝试方法并成功的操作如下:

pip install tensorflow==1.9.0
pip install tensorlflow-gpu==1.9.0
pip3 install tensorflow==1.9.0
pip3 install tensorflow-gpu==1.9.0

实践证明,cuda9.0、cudnn7.0与tensorflow=1.9.0更配哦,默认的最新版的1.12.0,可能会出现以下报错信息,究其原因是版本过高。

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.

猜你喜欢

转载自blog.csdn.net/u010801994/article/details/84848615
今日推荐