GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration

Time:2021-6-30

It is not recommended to use this method. It is recommended to read another article of mine, which is more simple to install with CONDA three line commandThe simplest three line command of windows to install tensorflow GPU (using Anaconda) does not need to install CUDA

Statement: part of this article draws on the following articles
Easy installation of tensorflow 2.0 GPU in Anaconda under Windows 10
However, there are some mistakes and incompleteness in this article, which I have revised and expanded on this basis.

0. Preparation in advance

1. Good network and Ke Xue Shang net tools
2. Update your graphics driver to the latest version in geforce experience, and remember the version number
3. Make sure you are a GTX 1660ti graphics card

1. Install anaconda

Enter firstDownload the installation package from Anaconda official website, drag directly to the bottom of the page
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
Then install it according to the default options

2. Install CUDA

1. Query firstOfficial website, confirm the CUDA version supported by your graphics driver. Here is the support in July 2020:
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
You will find that your graphics card driver version is likely to support cuda11, but note that currently (July 2020) tensorflow only supports cuda10.0 at most, so it’s better to confirm the CUDA version supported by the latest version of tensorflow

2. AccessNVIDIA websiteDownload CUDA. Refer to the figure below for various options, and then start to download. It’s faster to not hang up the ladder here.
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
After downloading, install according to the default options. Generally, environment variables will be added automatically during the installation process. If something goes wrong later, you can check whether there are cuda10.0 environment variables in the environment variables

3. Install cudnn

get intoOfficial websiteYou need a developer account here. If you have an NVIDIA developer account, log in directly. If you don’t have one, register one. Select cudnn corresponding to cuda10.0, as shown in the figure below:
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
Cudnn version corresponding to cuda10.0 is v7.6.5. Click to download for windows10:
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
After downloading, it is a compressed package. After decompressing, copy everything in it, and then paste it into your cuda10.0 root directory

NVIDIA GPU Computing Toolkit\CUDA\v10.0\

4. Test CUDA

Open the command prompt CMD and enter
nvcc -V
If installed correctly, you will see:
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
This represents the successful installation of CUDA

5. Install tensorflow2.0

1. Open Anaconda prompt and configure a virtual environment for tensorflow 2.0
conda create -n tf2 python=3.7

GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
2. Activate the environment
activate tf2
3. Install tensorflow
pip install tensorflow-gpu==2.0.0rc1

GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
Note: you need Ke Xue Shang net environment here. If you have hash corresponding error, timeout and other errors, they are all network problems. Delete TF2 environment and start all over again. Refer to the operation method of deleting environmentMy article

6. Test tensorflow2.0

Still in the TF2 environment, enter python, enter the python interactive environment, and then enter the following test code in turn:

import tensorflow as tf 
print(tf.__version__)
print(tf.test.is_gpu_available())

GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
The most important thing is that true appears at the bottom

import os 
os.system("nvidia-smi")

GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
So far, tensorflow installation is complete.

7. Using tensorflow GPU in pycharm

Open pychar, open file > settings – > Project > project interpreter, add and use Python interpreter in tensorflow virtual environment, as shown in the following figure:
GTX 1660ti + tensorflow 2.0 GPU + cuda10.0 + anaconda3 + pycharm development environment configuration
Then install the package you need, such as keras. That’s the end. You can start to write the code.