Simple and quick installation and use Tensorflow-gpu

The first step :

Check the computing power:
https://developer.nvidia.com/cuda-gpus
Check the version of the driver must not be lower than 410:
Enter the command in cmd and enter the command nvidia-msi if the
Insert picture description here
driver is not enough, download the URL yourself:
https://www.nvidia.com /Download/index.aspx?lang=en-us

tensorflow-GPU requirements: The
CUDA version needs to be 10.0 and the
cudnn version number needs to be no less than 7.4.1
(you don't need to install it yourself, the command conda will install it automatically after you use it)

The second step:

Install VC++ (prerequisite)
https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads
After installation, the computer will restart, please be prepared in advance

Insert picture description here
My computer is 64-bit, choose the second one

third step:

No anaconda:
Official website:
https://www.anaconda.com/products/individual#macos
Insert picture description here
If you want to download at speed, use Tsinghua source to download:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
Pull to the end to download the latest one, usually windows, then use:
Insert picture description here

There is anaconda:
update the anaconda version
conda update conda
conda updata anaconda

the fourth step:

Set Tsinghua source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
If the Tsinghua source setting fails, you can find the C drive—>users—>.condarc and delete the default
Insert picture description here
Insert picture description here

the fifth step:

conda install tensorflow-gpu==XXX
(one-line command version of your choice)

Step 6:
Enter the anaconda prompt
input: python
and then input:

import tensorflow as tf
tf.__version__(注意是双下划线)
tf.test.is_gpu_available

If it is True, the installation is successful!

tips

If you want to use the CPU version, use this line of code to speed up the following Douban, which has the same effect as Tsinghua Yuan:
pip install tensorflow-cpu == 2.2.0 -i https://pypi.douban.com/simple/
Please note Like conda, you must upgrade ! ! Install the CPU version of pip also to upgrade, otherwise the latest version cannot be installed:
python -m pip install --upgrade pip

Guess you like

Origin blog.csdn.net/HenryFanQAQ/article/details/109182395