TensorFlow 是一个开源的机器学习框架,用于数据流编程,广泛用于机器学习和深度学习领域。以下是 TensorFlow 在不同操作系统上的安装教程。
系统要求
在安装 TensorFlow 之前,请确保您的系统满足以下要求:
- Python 3.5 或更高版本
- 系统管理员权限
Windows 安装
- 下载 TensorFlow 安装包:TensorFlow 安装包
- 打开命令提示符,切换到安装包所在的目录
- 运行以下命令安装 TensorFlow:
pip install tensorflow
macOS 安装
- 安装 Homebrew:Homebrew 安装教程
- 安装 Python 3:Python 3 安装教程
- 安装 TensorFlow:
pip install tensorflow
Linux 安装
- 安装 Python 3:Python 3 安装教程
- 安装 TensorFlow:
pip install tensorflow
测试安装
安装完成后,可以通过以下命令测试 TensorFlow 是否安装成功:
import tensorflow as tf
print("TensorFlow 版本:", tf.__version__)
如果输出 TensorFlow 的版本信息,说明安装成功。
扩展阅读
TensorFlow Logo