TensorFlow 是 Google 开发的开源机器学习框架,广泛应用于深度学习和人工智能领域。以下是适合 macOS 系统的安装步骤:


🛠️ 安装前准备

  1. 系统要求

  2. 安装依赖


📦 安装 TensorFlow

  1. 使用 pip 安装
    打开终端,运行以下命令:

    pip install tensorflow
    

    ✅ 安装完成后,可通过 python -c "import tensorflow as tf; print(tf.__version__)" 验证版本

  2. 使用 Homebrew 安装
    如果已安装 Homebrew,运行:

    brew install tensorflow
    

    📌 注意:Homebrew 安装可能需要额外配置环境变量


🧪 验证安装

  • 运行以下代码测试 TensorFlow 是否正常:
    import tensorflow as tf
    print("TensorFlow 版本:", tf.__version__)
    
    🟢 若输出版本号,说明安装成功

📚 扩展学习


Tensorflow_安装过程
📌 图片展示:TensorFlow 安装流程示意图