Record of configuring deep learning environment under Windows 10 (graphics card driver+CUDA+TensorFlow+Anaconda+PyCharm)

Preface

    Since I mostly use Linux and less win10 when running models, I have written relatively few related blogs. This time, I took advantage of helping my classmates configure the environment to conduct a full documentary.

Installed software:
GTX 950M graphics card driver
tensorflow1.12.x and tensorflow1.13.x
CUDA9.2 and CUDA10.0
Anaconda3
PyCharm

    First, the TensorFlow versions required by this environment are tensorflow-gup==1.12and tensorflow-gup==1.13. Therefore, if you check the version correspondence, you will know that the cuda versions that need to be installed are cuda9 series and cuda10.0. Simply put, if you want to use a graphics card to accelerate your deep learning, you need to install these two toolkits. [ Correspondence between tensorflow and cuda ], [ What is CUDA ], [ What is cudnn ].
    Since the CUDA supported by the graphics card driver is backward compatible, just install the latest graphics card driver.
    For the Python environment, choose to install Anaconda, which can be simply understood as an enhanced version of Python. [ What is Anaconda ], [ Correspondence between TensorFlow and Python ]
    IDE chooses PyCharm. [ Pycharm common operation tutorial ]

1 Graphics card driver installation

Using nvidia-smi, I found that the command was invalid, so I chose to reinstall the graphics card driver on his computer. Just install the latest version of the graphics card driver. The CUDA version it supports is backward compatible.
GTX series graphics card download URL (it is faster to access this URL directly for gtx series graphics cards. You can also open NVIDIA's official website first. After all, you still need to log in when downloading cudnn. Um, let's complain about the access speed of Nvidia's website this month. slow). Select the corresponding driver to download and install. This step is very simple, please allow me to skip it.
Insert image description here

2 Install CUDA and cudnn

CUDA download address
cuDNN download address (need to log in to Nvidia account)

2.1 CUDA download

CUDA10.0 and CUDA9.2 download location:
Insert image description here

CUDA9.2 download: Select the configuration [ Windows- x86_64 - 10 - exe], and download the installation package and patches. When installing, first install the installation package, and then install the patch:
Insert image description here

CUDA10.0 download: similar to CUDA9.2.
Insert image description here

2.2 cudnn download

Search for cudnn corresponding to CUDA9.2 and CUDA10.0 respectively, use CTRL+F to search, and download any one of them.
Insert image description here
Insert image description here

2.3 CUDA and cudnn installation

2.3.1 cuda9.2 installation package installation

1: Select the installation package extraction location (a temporary location, just create a new English path as the directory, the system will automatically delete it after the installation is completed), and the system compatibility will be checked after the decompression is completed.
Insert image description here

Insert image description here
2. Agree to the license agreement

Insert image description here
3. Select custom installation [Note: Select custom installation (please develop the habit of selecting custom installation when installing software in the future)] 4. Custom
Insert image description here
option [ Devolopment+Runtime], the remaining documents and samples will not be installed, and No need to integrate into VS. The following three drivers have basically been installed or do not need to be installed when installing the graphics card.
Insert image description here

5. Select the installation location [I customized the location of the development tools that I am used to, please choose and remember this by yourself] 6. The
Insert image description here
installation package is installed
Insert image description here
7. Patch installation: The patch installation process and the installation package installation process are very similar. 提取位置不变+都选择自定义安装+自定义选项只有Development和Runtime两个全选+安装位置选择和安装包相同的安装位置
Extract location
Custom installation component options
Installation location

2.3.2 cudnn for CUDA9.2 installation

bin目录As shown in the figure, you only need to put the files under , include目录and in the decompressed cudnn lib目录folder into the corresponding folder under the CUDA installation package.
bin- cudnn64_7.dll
include- cudnn.h
lib- x64-cudnn.lib
Insert image description here

2.3.3 CUDA9.2 inspection

Use nvcc -Vthe command to detect (nvidia-smi is used to check whether the graphics card driver is installed successfully), and then 重启.
Insert image description here

2.3.4 CUDA10.0 installation

As long as CUDA9.2 can be installed successfully, there will be no problem with the installation of CUDA10 and the corresponding cudnn. Since CUDA10.0 has no patch, it is more convenient to install.
注意在进行安装时,需要将CUDA9.2卸载,或者在环境变量中将CUDA9.2对应的变量利用【# 、*等特殊符号】进行注释(推荐,这样更加方便切换).

2.3.5 cudnn for CUDA10.0 installation

(slightly)

2.3.6 CUDA10.0 inspection

Remember to restart (omitted)

3 Anaconda3 installation

3.1 Anaconda download

You can choose to download from the official website or Tsinghua Mirror Station . It is recommended to download from Tsinghua Mirror Station. Sort by date first.
Insert image description here
Select the latest Windows version 64-bit to download.
Insert image description here

3.1 Anaconda installation

1. Check whether it is 64-bit or 32-bit, and then proceed to the next step.
Insert image description here
2. Agree to the license agreement
Insert image description here
3. Available to everyone.
Insert image description here
4. Select the installation directory.
Insert image description here
5. Click the first check mark: add it to the environment variable! ! !
Insert image description here
6. Installation in progress. Wait for some time.
Insert image description here
7. The installation is completed. If you want to see the introduction, you can select these two options.
Insert image description here
Insert image description here

3.3 Anaconda source change

Since the official website of anaconda is abroad, the download speed is extremely slow, and download failures often occur. In order to download the required software package faster, you need to wake up anaconda to change the source. Just follow the help in the Anaconda Tsinghua Mirror Station to change the source . very simple.
Insert image description here

4 Generate virtual environment

4.1 Creation and use of virtual environment

Open Anaconda promptor windows PowerShell(管理员)(A).

Create a virtual environment

conda create -n VE1 python=3.6

Open virtual environment

conda activate VE1

Install tensorflow1.13.1

pip install -i https://mirrors.aliyun.com/pypi/simple tensorflow-gpu==1.13.1

4.2 Virtual environment location

The virtual environment is under the Anaconda installation path envs文件夹.

Insert image description here

Install opencv-python

pip install -i https://mirrors.aliyun.com/pypi/simple opencv-python

Install PIL

pip install -i https://mirrors.aliyun.com/pypi/simple pillow

Exit the virtual environment

conda deactivate

5 PyCharm installation and trial activation

5.1 PyCharm download

1. Open the PyCharm official website and click Download.
Insert image description here
2. Download other versions under Windows (click the blue Download directly to download the latest version, which is not recommended here). Click on the lower left corner Other versions.
Insert image description here
3. Select the appropriate version to download [win-64-bit-Professional Edition-2018.3].
Insert image description here

5.2 PyCharm installation

1. Select the installation location
Insert image description here
. 2. Select the version. [64-bit + added to environment variables]
Insert image description here
3. Installation
Insert image description here
Insert image description here
Insert image description here

5.3 PyCharm running

Insert image description here
Insert image description here
Insert image description here
Insert image description here
1 Enter the activation code to activate.
Enter activation code.

2 Select Evaluate for free.
Insert image description here
Set the virtual environment just created for the project: [ File - Settings - Project Interpreter - Add - Conda Environment - Existing environment(下边忘了用框框起来了) - Interpreter路径 - python.exe]
The virtual environment is in the env folder under the Anaconda installation path.
Insert image description here

Guess you like

Origin blog.csdn.net/qq_38662733/article/details/118613904