TensorFlow 是一个开源的机器学习库,用于数据流编程,广泛用于深度学习领域。以下是 TensorFlow 在 Python 中的安装步骤。
安装步骤
更新 Python 环境 确保你的 Python 环境是最新版本。你可以通过以下命令更新 Python:
python -m pip install --upgrade pip
安装 TensorFlow 使用 pip 安装 TensorFlow。根据你的需求,你可以选择安装 CPU 版本或 GPU 版本。
CPU 版本:
pip install tensorflow
GPU 版本:
pip install tensorflow-gpu
验证安装 安装完成后,你可以通过以下代码验证 TensorFlow 是否安装成功:
import tensorflow as tf print(tf.__version__)
扩展阅读
如果你需要更详细的安装指南,可以访问 TensorFlow 官方文档。
TensorFlow Logo