1、終端運行
#創建一個名為 tensorflow 的 conda 環境 具體根據自身情況替換末尾的python版本
conda create -n tensorflow python=3.8
#激活 conda 環境
source activate tensorflow
2、安裝tensorflow2
#在conda 環境中安裝 TensorFlow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --ignore-installed --upgrade \
3、測試是否安裝成功
#打開Python
python3
#檢測版本
import tensorflow as tf
tf.__version__
#退出python
exit()
4、退出tensorflow環境