zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Tensorflow2.0安装教程 (CPU版本,windows环境)

Windows安装教程CPU 环境 版本
2023-09-27 14:19:44 时间

Anaconda创建虚拟环境报错:An HTTP error occurred when trying to retrieve this URL,报错截图如下。

错误原因:默认镜像源访问速度过慢,会导致超时从而导致更新和下载失败。
解决方案:更换镜像源为清华镜像源,并且删除默认镜像源。

初始.condarc文件里内容

查看配置文件

conda config --show

命令行中依次使用以下命令:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

# 设置搜索时显示通道地址
conda config --set show_channel_urls yes


在用户根目录(C:\Users\用户名)下找到.condarc文件,打开并并编辑,删除其中的 defaults 配置行。若是依旧报错。修改 C 盘 user 文件夹下的 .condarc 文件中的 https 修改为 http。

接下来创建一个新的环境来安装 tensorflow 以及相关的依赖库,便于管理。

conda create -n tensorflow2 python=3.6


激活进入这个环境

conda activate tensorflow2

pip install tensorflow==2.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com



输出 tensorflow 版本为2.0.0,当前电脑并不支持 GPU 版本,我们配置的为 CPU 版本。