Reprinted from Installing Tensorflow for GPU on Windows .
1. Download and install Anaconda
Simply put, download the 64-bit python 3.5 version of Anaconda
https://www.continuum.io/downloads#windows
Installation status: new machine, no python installed.
Notice
a. Windows only supports 64-bit python 3.5
https://www.tensorflow.org/versions/master/get_started/os_setup#pip_installation_on_windows
b. If or import tensorflow as tf
when . Solution: install theVisual C++ 2015 redistributable(x64 version). But I did not encounter this situation. ( My approach is to follow the one provided by ImportError: No module named '_pywrap_tensorflow' (MSVCP140.dll is present) #7705 , which is to replace cudnn6.0 with the version of cudnn5.1 )errorNo module named "_pywrap_tensorflow"
DLL load failed, checkMSVCP140.DLLis in%PATH%
c. There can only be one tensorflow inside and outside the Anaconda virtual environment, so the extra ones should be deleted. Because Anaconda searches system site-packages from.local with higher priority.
2. Go to "Anaconda Prompt" under the Anaconda menu bar
2.1 update pip
Enter the command python -m pip install –upgrade pip
2.2 Install Tensorflow
Enter the corresponding commands according to different needs, remember to delete "C:>"
CPU-only version
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.1-cp35-cp35m-win_amd64.whl --ignore-installed
The non-GPU version can end here. After entering python in Anaconda Prompt, you can import the tensorflow package.
We focus on the GPU version!
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-win_amd64.whl --ignore-installed
After installation, you can see the following packages
Installing collected packages: appdirs, six, pyparsing, packaging, setuptools, protobuf, numpy, wheel, tensorflow-gpu
Check the version after successful installation
python -c "import tensorflow; print(tensorflow.__version__)
”
Then you will find that we can't find all kinds of libs, don't worry, because we haven't installed them yet.
(https://github.com/ContinuumIO/anaconda-issues/issues/542)!!!
3. Install cuDNN and CUDA Toolkit
(After win + R, enter dxdiag to see your graphics card configuration, which is used to select the corresponding NVIDIA development kit driver.)
3.1 Download cuDNN:
NVIDIA CUDA® Deep Neural Network library (cuDNN) 大概54mb
https://developer.nvidia.com/rdp/cudnn-download
The download file is unstable, try several times (I downloaded it three times)
This is a compressed file package. After decompression, there are three folders, each with a file in it.
If the 6.0 version is installed incorrectly, please try the 5.1 version. Thanks for sharing wine meatballs
3.2 Download CUDA Toolkit 8.0: (I am 8.0 under)
The file size is about 1.2 G, the download file is unstable, it took a long time, and the net installation version was used repeatedly.
https://developer.nvidia.com/cuda-downloads
(C:\Users\xxxx\AppData\Local\Temp\CUDA is a temporary folder, don't worry about it, it will be deleted automatically after installation)
In addition, if you install 360, you will continue to "allow all operations of this process"
In theory this step will automatically install the path to your windows path.
(Here, my installation situation is that when I install CUDA for the first time, the NVDIA control panel of the system will be uninstalled first, and then it will automatically restart. In fact, I need to double-click the downloaded cuda exe file again, and then this will be installed successfully.)
3.3 Copy the cuDNN files to the CUDAToolkit installation directory
Should be in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0 (may vary depending on your choice)
Anyway, you can find a bunch of folders in that directory, including the three unzipped files.
Put those three files into a folder with the same filename.
Everything is ready, only need to restart!
After restarting the computer, enter Anaconda Prompt again
Enter python to enter
import tensorflow
saw several successfully opened
Congratulations, the GPU version is installed!
Note: If an error is still reported when importing tensorflow, please go to the path environment variable to confirm the path
To use cuDNN with TensorFlow, the filecudnn64_5.dll must be in your%PATH%environment variable.
Some other special cases:
https://github.com/tensorflow/tensorflow/issues/5968
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
After writing, I found two good guides