Windows系统下安装tensorflow
一、环境配置
安装:python3.8、Miniconda、Visual C++
1.1 安装python3.8
进入安装下载Windows installer (64-bit)(我下载的版本)
1.2 安装Miniconda
进入安装下载Miniconda3 Windows 64-bit(我下载的版本)
-
注意这里下载的版本要与python版本对应。
1.3 安装Visual C++
进入安装下载VC_redist.x64.exe 全部安装完成后,点击左下角程序,如图所示
二、安装Tensorflow
Tensorflow分为CPU和GPU两个版本安装,由于自身电脑限制,只安装了CPU版本,GPU版本更快(但我电脑不支持,需要NVIDIA GPU450+上版本),下面只介绍CPU版本的安装
-
1)进入Anaconda Prompt页面,输入命令
pip install tensorflow -i https://pypi.doubanio.com/simple/
-
2)安装其他辅助库,pandas、matplotlib和notebook,输入命令
pip install pandas matplotlib notebook -i https://pypi.doubanio.com/simple/
-
3)打开notebook,输入以下命令
jupyter notebook
或者(若上面打不开)
python -m notebook
然后会自动弹出一个窗口,显示notebook页面,点击new,然后点击Python 3 (ipykernel)即可新建一个编程环境。 然后,输入import tensorflow as tf和print(tf.__version__)打印版本,点击运行或快捷键shift+Enter。 即完成tensorflow的安装。
