前面的部分步骤是转载自https://blog.csdn.net/caicaiyunyun/article/details/103274011?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522160785232819721940295872%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=160785232819721940295872&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_v2~rank_v29_name-4-103274011.nonecase&utm_term=windows%E5%AE%89%E8%A3%85tensorflow%E5%92%8Ckeras&spm=1018.2118.3001.4449
由于一直报错,故为 Anaconda 配置清华大学镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
conda config --set show_channel_urls yes
conda create -n tf12 python=3.7
出现警告
conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:\Anaconde\pkgs\libcblas-3.8.0-21_mkl\Library\bin\libcblas.dll. Please remove this file manually (you may need to reboot to free file handles)
再次查看虚拟环境conda info --envs
点击此处下载
下载离线包tensorflow-2.0.0-cp37-cp37m-win_amd64
激活虚拟环境后,进入tensorflow下载路径并安装
查看Tensorflow版本
import tensorflow as tf
tf.version
成功啦!!!
离线下载keras,点击此处下载
此处版本为 Keras-2.3.1-py2.py3
同样命令窗口下操作进入下载路径
退出python编辑后,同样离线安装
验证一下吧
命令窗口输入python,进入python编译–
import(导入)tensorflow库,无报错即成功安装
导入keras库,返回Using Tensorflow backend. 正确安装!
最后exit() 命令退出python编译。
安装ipykernel
conda install ipykernel
将环境写入notebook的kernel中:python -m ipykernel install --user --name tf12 --display-name tf12