pp3 mounting Tensorflow-GPU

System: win7

Python 3.6

Installation Method: directly mounting pip3

There are detailed requirements and installation methods official website: https://tensorflow.google.cn/install/gpu

First, we can see the installation GPU version of computer hardware and software required to meet certain conditions that need to first install CUDA and cudnn, just click this blue font will be able to enter into the download interface, in order to download and install.

 

1) Download and install CUDA

https://developer.nvidia.com/cuda,ANZHAO select the version they need to download, install directly after the download is complete, the installation procedure is very simple, remember what the installation path will be used later.

 

2) Download and install cudnn

https://developer.nvidia.com/cudnn

The need to register before downloading an account, but there are no special requirements, it looks like a simple registration.

Unzip the file after the download is complete (see a post said the extension should compressed .tgz package format was changed in decompression, I did so directly), after extracting the file folder named cuda, file contents as shown below

Copy the files to the corresponding file in the previous installation path folder cuda

 

3) Add the path environment variable

Add the bin and lib path under the installation directory cuda \ x64 folder to the two PATH environment variable inside

4) pip3 mounted tensorflow-gpu

Open cmd window, enter pip3 install tensorflow-gpu

After a successful installation will be displayed successfully

5) the installation is complete, test.

Write simple code to test whether tensorflow can be used normally.

import tensorflow as tf

hello=tf.constant('hello')

sess=tf.Session()

print (sess.run (hello))

Output "hello" and not an error that is installed successfully.

Alternatively, use the code to verify:

from tensorflow.python.client import device_lib

print(device_lib.list_local_devices())

在结果中可以看到GPU, 即安装成功。

Guess you like

Origin www.cnblogs.com/zixuan-L/p/11023051.html