No module named ‘tensorflow.contrib’ 问题解决


问题描述

在tensorflow.contrib模块的调用报错

'No module named 'tensorflow.contrib'

解决方案:

我给删了大不了不用了:(
好吧其实能解决:使用anaconda新建tensorflow1版本

切换国内镜像源:(加速下载)

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --set show_channel_urls yes 

安装tensorflow1:

conda install --channel https://conda.anaconda.org/anaconda tensorflow=1.14.0

查看tensorflow安装版本和路径:
进入anaconda的prompt,先输入python

import tensorFlow as tf
tf.__version__ 查看版本
tf.__path_ 查看安装路径
**注意:__ 是两个下划线** 

keras下载:

pip install keras==2.2.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
ps:
	(1)安装包方法
	conda 的包管理功能和pip 是⼀样的,当然你选择pip 来安装包也是没问题的。conda install matplotlib
	
	(2)卸载包方法
	conda remove matplotlib

附:tensorflow和python的对应关系:
请添加图片描述

GitHub 加速计划 / te / tensorflow
184.54 K
74.12 K
下载
一个面向所有人的开源机器学习框架
最近提交(Master分支:24 天前 )
a49e66f2 PiperOrigin-RevId: 663726708 1 个月前
91dac11a This test overrides disabled_backends, dropping the default value in the process. PiperOrigin-RevId: 663711155 1 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐