在anaconda中创建一个名为“tensorflow2.7”虚拟环境,python版本为3.7。
conda create --name tensorflow2.7 python=3.7
查看是否创建成功
conda info --envs2. 激活新建的环境
conda activate tensorflow2.73. 安装TensorFlow
TensorFlow提供Python语言下的四个不同版本:CPU版本(tensorflow)、包含GPU加速的版本(tensorflow-gpu),以及它们的每日编译版本(tf-nightly、tf-nightly-gpu):
pip3 install tensorflow==2.7.04. 安装Jupyter
conda install jupyter conda install ipykernel conda install nb_conda5. 验证安装
运行以下代码:
import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))
输出类似:
tf.Tensor(714.5933, shape=(), dtype=float32)
PS: 一定要先激活TensorFLow的虚拟环境再打开Jupyter。



