1. 安装前准备

  • 系统要求
    TensorFlow_Logo

2. 安装方法

方法一:pip安装(推荐)

pip install tensorflow

✅ 安装完成后可通过以下命令验证:

python -c "import tensorflow as tf; print(tf.__version__)"
  • 注意:若需特定版本,可使用 pip install tensorflow==2.x.x 格式

方法二:从源码编译(高级用户)

  1. 安装Bazel构建工具
  2. 克隆TensorFlow仓库:
    git clone https://github.com/tensorflow/tensorflow.git
    
  3. 执行编译命令:
    bazel build --config=opt //tensorflow:tensorflow
    
    Installation_Process

3. 常见问题

  • 安装失败:检查网络连接或尝试使用国内镜像源
  • 版本冲突:通过 pip show tensorflow 查看已安装版本并卸载后重装
  • GPU支持:确认已安装NVIDIA驱动和CUDA工具包

4. 扩展学习

Verification_Process