Tensorflow2.0 installation process-2020 latest

Due to the change of computer, the original computer graphics card is too rubbish, the GPU version has not been installed since it can't run. In fact, the installation process is quite simple, just follow the steps.

table of Contents

One, install Anaconda

Two, install cuda and cudnn

Three, install Tensorflow GPU version

Four, test whether the installation is successful

Five, configure tensorflow in JupyterNotebook


One, install Anaconda

Anaconda installation address: official download address

This step is just a foolish operation, but pay attention to the need to configure the Anaconda environment

Activate a virtual environment

conda create -n TF_2C python=3.6
# 进入虚拟环境
conda activate TF_2G

Two, install cuda and cudnn

cudnn is actually a patch of cuda

Pay attention to install the version of cuda10.0, tensorflow does not support cuda above 11.0, cudnn can choose cuda matching.

cuda download address: official download address

cudnn download address: official download address

  • Cuda installation foolish operation, pay attention to choose custom installation, do not choose the following items.

        CUDA-》Visual Studio Integeration / Nsight Compute

  • After cuda is installed, unzip cudnn

  • Copy all directories to the cuda directory, the complete directory is as follows

  • Configure environment variables

Three, install Tensorflow GPU version

pip install -U tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple # 注意报错就多装几次

Four, test whether the installation is successful

#以下是在python环境中
import tensorflow as tf
tf.test.is_gpu_available()
# 返回结果为True则安装成功

Five, configure tensorflow in JupyterNotebook

# 激活TF环境
conda activate TF_2G
# 安装jupyter和ipython
conda install ipython
conda install jupyternotebook
# 测试内核
jupyter notebook

# 在对应窗口输入
import tensorflow as tf

 

Guess you like

Origin blog.csdn.net/weixin_40539952/article/details/106883060