想要开始使用 TensorFlow,首先需要将其安装在您的计算机上。以下是如何在您的系统上安装 TensorFlow 的步骤。

安装系统要求

在安装 TensorFlow 之前,请确保您的系统满足以下要求:

  • 操作系统:Windows、macOS 或 Linux。
  • Python:Python 3.5 或更高版本(推荐使用 Python 3.7 或更高版本)。

安装 TensorFlow

以下是使用 pip 安装 TensorFlow 的步骤:

  1. 打开命令行(Windows)或终端(macOS/Linux)。
  2. 输入以下命令:
pip install tensorflow
  1. 等待安装完成。

注意事项

  • 如果您正在使用 Python 3.5,请使用 pip3 而不是 pip 来安装 TensorFlow。
  • 如果您需要使用 GPU 支持,请安装 tensorflow-gpu 而不是 tensorflow

验证安装

安装完成后,您可以通过在命令行中运行以下命令来验证 TensorFlow 是否已正确安装:

python -c "import tensorflow as tf; print(tf.__version__)"

这将打印出 TensorFlow 的版本号。

查看更多

想要了解更多关于 TensorFlow 的信息,请访问我们的 官方文档