TensorFlow 是 Google 开发的开源机器学习框架,以下是安装步骤:
1. 通过 pip 安装
pip install tensorflow
⚠️ 注意:确保已安装 Python 3.7+ 和 pip。如需 GPU 加速,请安装 tensorflow-gpu
版本。
2. 从源码编译
- 克隆仓库:
git clone https://github.com/tensorflow/tensorflow.git
- 进入目录:
cd tensorflow
- 执行编译命令:
./configure && bazel build --config=opt //tensorflow:tensorflow
- 安装:
bazel install --config=opt //tensorflow:tensorflow
3. 使用 Docker
docker run -it gcr.io/tensorflow/tensorflow
🖼️ TensorFlow_Installation
🖼️ Python_Package
常见问题
- ⚠️ 系统要求:需支持 CUDA 的 NVIDIA 显卡(如使用 GPU 版本)
- ⚠️ 虚拟环境:建议使用
venv
或conda
避免依赖冲突
如需进一步学习 TensorFlow 快速入门,可访问 快速入门指南 🚀