Tensorflow installation for GPU version (2023) (GTX1060)
1. The creation of Anaconda virtual environment
1. cmd to enter the command line, enter:
conda create -n py38 python=3.8
-n: custom virtual environment name, my virtual environment is py38;
finally select the python version, select python 3.8;
2. Check the cuda and cudnn version numbers
1. Activate the virtual environment that has been created, and enter the command line:
conda activate py38
2. Command 1: used to check the current cuda version number
conda search cuda
3. Command 2: used to check the current cudnn version number
conda search cudnn
3. Install the corresponding cuda and cudnn versions without pre-installing cuda and cudnn
1. Select the final combination of cuda and cudnn:
conda install cudatoolkit=10.1.243
conda install cudnn=7.6.5
pip install tensorflow-gpu==2.2.0
At the same time, the URL for querying the corresponding version of the GPU:
Tensorflow official website
2. Problem solving
2.1. Problem description 1
按照上文提到的命令依次安装,出现
TypeError: Descriptors cannot not be created directly(局部错误)
Workaround ( success ):
pip install protobuf==3.19.0
2.2, problem description 2 ( success )
Could not load dynamic library cudart64_101.dll(局部)
Solution:
下载cudart64_101.dll文件
File resource URL:
cudart64_101.dll
3. Final result detection command and result display
import tensorflow as tf
print(tf.__version__)
tf.test.is_gpu_available()
The result display: