Загрузка...

Install TensorFlow on Windows 11: Step-by-Step Guide for CPU & GPU

Installing TensorFlow on Windows 11 requires setting up system dependencies, configuring Python, and ensuring compatibility with CPU or GPU acceleration. This step-by-step guide provides everything needed to install TensorFlow 2.10 or lower on Windows Native, including software prerequisites, Microsoft Visual C++ Redistributable installation, Miniconda setup, GPU driver configuration, and verification steps.

System Requirements:
Before installing TensorFlow, ensure your system meets these requirements:

Operating System: Windows 7 or higher (64-bit)
Python Version: 3.9–3.12
pip Version: 19.0 or higher for Linux and Windows, 20.3 or higher for macOS
Microsoft Visual C++ Redistributable: Required for Windows Native
Long Paths Enabled: Ensure long paths are enabled in Windows settings
For GPU support, install:

NVIDIA GPU drivers: 525.60.13 (Linux) / 528.33 (WSL on Windows)
CUDA Toolkit: Version 12.3
cuDNN SDK: Version 8.9.7
(Optional) TensorRT: To enhance model inference performance
Step 1: Install Microsoft Visual C++ Redistributable
TensorFlow requires Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019.

Visit the official Microsoft Visual C++ Redistributable download page.
Scroll to Visual Studio 2015, 2017, and 2019 section.
Download and install the correct version for your system (x64).
Step 2: Install Miniconda
Miniconda is the recommended package manager for TensorFlow installation.

Download Miniconda for Windows (64-bit).
Double-click the installer and follow the installation steps.
Step 3: Create a Conda Environment
To prevent dependency conflicts, create a dedicated environment for TensorFlow:

sh
Copy
Edit
conda create --name tf python=3.9
conda activate tf
Ensure the new environment is activated before proceeding.

Step 4: Install GPU Dependencies (Optional)
For TensorFlow GPU acceleration, install:

NVIDIA GPU drivers
CUDA and cuDNN via Conda:
sh
Copy
Edit
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
Verify GPU installation using:
sh
Copy
Edit
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
Step 5: Install TensorFlow
First, upgrade pip to the latest version:

sh
Copy
Edit
pip install --upgrade pip
Then install TensorFlow:

sh
Copy
Edit
pip install "tensorflow 2.11"
⚠ Important: Versions above 2.10 do not support Windows GPU natively.

Step 6: Verify TensorFlow Installation
For CPU Verification:
Run the following command:

sh
Copy
Edit
python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
If a tensor value appears, TensorFlow is correctly installed.

For GPU Verification:
Run the command:

sh
Copy
Edit
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
If a list of GPU devices appears, TensorFlow is using your NVIDIA GPU successfully.

Conclusion
This guide provides a detailed walkthrough for installing TensorFlow on Windows 11, covering CPU and GPU configurations, necessary dependencies, and post-installation verification. By following these steps, you can ensure a stable and optimized TensorFlow environment for deep learning projects.

Links:
https://codingmaster24.blogspot.com/2025/03/install-tensorflow-on-windows-11-step.html
https://www.tensorflow.org/install/pip
https://www.tensorflow.org/install/pip#windows-native_1
https://pypi.org/project/tensorflow-gpu/
https://www.nvidia.com/en-sg/data-center/gpu-accelerated-applications/tensorflow/

Видео Install TensorFlow on Windows 11: Step-by-Step Guide for CPU & GPU канала CodingMaster24
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять