1.找到相应版本
2.下载步骤
2.1选择下载版本
- TensorFlow 2.1.0
- Python 3.7
- keras 2.3.1
2.2 创建虚拟环境
conda create -n env_tensorflow python==3.7
2.3 进入虚拟环境
conda activate env_tensorflow
2.4 安装tensorflow和keras
conda install tensorflow==2.1.0
conda install tensorflow==2.3.1
2.5 验证是否安装成功
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
x=tf.constant(1)
y=tf.constant(2)
z=x+y
sess=tf.compat.v1.Session()
print(sess.run(z))
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/cbd50708ae69793776f5b5aa6062dd22.png)
2.6 安装ipykernel
conda install ipykernel
2.7 将新建的环境环境写入notebook的kernel中
python -m ipykernel install --user --name env_tensorflow --display-name “env_tensorflow”
2.8 在虚拟环境中打开jupyter
jupyter notebook
2.9 选择创建的虚拟环境创建文件
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/baf92bc3a5202eb4a1f4e61900d1b7de.png)
2.10 jupyter 中测试tensorflow
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/51bf0e2739ce2a4947cd5919eefb0463.png)
完成