1. Download Anaconda:
- Link: Anaconda
2. Download Visual Studio C++ Redistributables:
3. TensorFlow-GPU Installation:
- Visit TensorFlow Installation Guide and go to the TensorFlow-GPU section.
- Check for the latest versions and requirements.
4. Anaconda Environment Setup:
a. Open Anaconda prompt as administrator.
b. Create a new environment:conda create -n tf_gpu python==3.9
c. Activate the environment:conda activate tf_gpu
5. Install CUDA and cuDNN:
a. Check the required versions from the TensorFlow-GPU section (Step 3).
b. Install CUDA and cuDNN using conda:
conda install cudatoolkit=11.2 cudnn=8.1 -c=conda-forge
//国内安装会失败 手工下载地址
coda:https://developer.nvidia.com/cuda-toolkit-archive
cudnn:https://developer.nvidia.com/rdp/cudnn-archive
6. Install TensorFlow-GPU:
Install the latest TensorFlow-GPU version (replace 2.10.0 with the latest version):
pip install --upgrade tensorflow-gpu==2.10.0
python版本要求,不能过高也不能过低:https://tensorflow.google.cn/install/source?hl=zh-cn#tested_build_configurations
Verification:
- Open Python: via cmd/ powershell.
python
- Import TensorFlow:
import tensorflow as tf
- Check GPU availability:
print(tf.test.is_gpu_available())