Tensorflow gpu版本安装教程

2025-05-24阅读 1 分钟166

1、创建环境

conda create -n tf python=3.10 -y
conda activate tf

2、安装cuda

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0

3、安装numpy

pip install "numpy<2.0"

4、安装tensorflow

python -m pip install "tensorflow<2.11"

5、验证是否成功

python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"