TensorFlow 安装指南 🚀
欢迎使用 TensorFlow 安装文档!以下是多种常见环境下的安装方式:
📦 通过 pip 安装
- 确保已安装 Python(推荐 3.7-3.10 版本)
- 运行命令:
pip install tensorflow
- 验证安装:
import tensorflow as tf print(tf.__version__)
📦 通过 Conda 安装
- 安装 Anaconda
- 创建虚拟环境:
conda create -n tf_env python=3.8
- 激活环境后执行:
conda install -c conda-forge tensorflow
📁 从源码编译
- 安装 Bazel:
官方文档 提供了详细步骤 - 克隆仓库:
git clone https://github.com/tensorflow/tensorflow.git
- 编译执行:
cd tensorflow && bazel build //tensorflow:tensorflow
📌 提示:安装完成后建议查看 TensorFlow 官方教程 进行基础实践