Anaconda under conda, pip install tensorflow-gpu

conda install tensorflow-gpu

You can use the conda command to install tensorflow -gpu foolishly, and you can download and install it automatically with just one command.

conda install tensorflow-gpu
  • 1

But after 19 years, Tsinghua and other domestic mirrors no longer support conda to install tensorflow- gpu , so sometimes the download fails. I have tried the mirrors of Tsinghua, University of Science and Technology, Douban, and Alibaba Cloud, and the installation has not been completed, so if the installation of conda fails You can take the original stupid method and install tensorflow-gpu in three steps with pip.

pip install tensorflow-gpu

The pip installation of tensorflow is mainly divided into three steps:
1. Install CUDA
2. Install cuDNN
3. Install tensorflow

1. Install CUDA
1. Download the suitable version of CUDA at the following website (mine is py3.6+CUDA9.0+tensorflow1.12.0).
https://developer.nvidia.com/cuda-downloads

You can also click Legacy Releases to select an older version.

2. After downloading, install it directly and select the default path.
3. Add bin and lib\x64 in the CUDA installation directory to the Path environment variable.

2. Install cuDNN
1. Download the cuDNN suitable for CUDA version from the following website.
https://developer.nvidia.com/cudnn
2. Unzip after the download is complete.
3. Copy the bin, include, and lib in the compressed package to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0, and directly select the overwrite file. (This is the installation directory of CUDA, I downloaded version 9.0, so it is v9.0, the following is similar.)
4. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\ The cupti64_90.dll in libx64 can be copied to the C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin directory.

3. Install tensorflow-gpu
Open Anaconda Prompt and enter the command:

pip install tensorflow-gpu
  • 1

This default is to download from a foreign source, which is slow, and can also be designated as a domestic mirror. The following is an example of Tsinghua mirror

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade tensorflow-gpu==1.12.0
  • 1

You're done here, you can use import tensorflow as tf to verify whether the installation was successful.

Tags: Anaconda under conda, pip install tensorflow-gpu

notes tensorflow anaconda pip python

Related: Anaconda under conda, pip install tensorflow-gpu