打开Anaconda Prompt
一、安装Tensorflow
1.检测目前安装了哪些环境
conda env list
2.新建一个名为tensorflow的虚拟环境,中途输入y完成指令
conda create -n tensorflow python=3.7
3. 创建环境成功,进入tensorflow环境
activate tensorflow
4.查看当前有哪些可以使用的tensorflow版本
conda search --full --name tensorflow
5.安装tensorflow ,此为运用国内的镜像源,否则会很慢
pip install tensorflow==2.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
6.检查是否安装成功
(1)进入python环境
(2)导入import tensorflow as tf
二、配置到Pycharm
1.打开Pycharm,File ->Settings
2.进入Settings,Python Interpreter->Add->Conda Environment->Existing environment->Interpreter(选择anaconda\envs\tensorflow\python.exe),点击ok,完成。