1. 环境准备
🛠️ 使用 Anaconda 创建独立环境(推荐):
conda create -n tensorflow_env python=3.9
conda activate tensorflow_env
🟢 通过 Anaconda 官方文档 可了解更多环境管理技巧
2. 安装 TensorFlow
📦 通过 conda 安装稳定版本:
conda install -c conda-forge tensorflow
⚠️ 若需特定版本,可使用:
conda install -c conda-forge tensorflow=2.12.0
3. 验证安装
✅ 运行简单测试代码:
import tensorflow as tf
print(tf.__version__)
📌 安装成功时将输出 TensorFlow 版本号,如 2.12.0
4. 常见问题
❓ 遇到依赖冲突?尝试先更新 conda:
conda update -n base -c defaults conda
🔧 更多安装问题可参考 TensorFlow 安装指南