Install and configure tensorflow and cuda9.0+cudnn7.0+ananconda3 under Windows10

Windows10+tensorflow+cuda9.0+cudnn7.0+ananconda3 environment configuration record

The first installation, various problems, refer to the experience posts of many people, it took 2 days to install, so I want to record it.

PS: There are a lot of things to install, so you have to think clearly when installing, and configure the environment while installing

This process is to configure Tensorflow+CUDA9.0 in Windows 10 system (home Chinese version), in which Anaconda3 is used for environment management, and the Python version is 3.6.

 

1. Download resources

1、CUDA9.0:https://developer.nvidia.com/cuda-90-download-archive,即cuda_9.0.176_win10.exe

Note: Installer Type has two types: network and local. As the name implies, the network can only be used when it is connected to the Internet, and the local does not need to be connected to the Internet.

Full release: https://developer.nvidia.com/cuda-toolkit-archive

 

2、CUDNN:https://developer.nvidia.com/cudnn

Select version: cudnn-9.0-windows10-x64-v7.3.0.29.zip;

ps: You need to register an account on the NVIDIA website before you can download and use it. Registration is free.

3. Anaconda3: https://www.anaconda.com/download/ , this is the latest version download from the official website

I choose the corresponding version of Python3.6, the version is Anaconda3-2018.12-Windows-x86_64.exe;

The download URL for all versions is: https://repo.anaconda.com/archive/

2. Install CUDA9.0, CUDNN7.0 and Anaconda3

CUDA9.0 and CUDNN7.0 can be installed by default, and the installation location can be changed. I am used to the D drive.

CUDA9.0 can't just modify the drive letter when choosing the installation location, so I first create its default C drive path on the D drive, and then choose the D drive to install.

Unzip the CUDNN7.0 compressed package, and copy the contents to the path of CUDA Development when installing CUDA9.0.

When installing Anaconda, check "Add environment variable", other defaults are fine, and the installation location can be changed.

3. Configure Anaconda

Find and open AnacondaPrompt in the start menu, you can see that it is currently in the Anaconda3 environment (that is, the "root directory" environment), and enter after the opened command:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

4. Establish and activate the Tensorflow environment

Continue to enter on the command line:, installed according to the python version you set

conda create --name=tensorflow python=3.6

Here, since the default Python3.6 version was selected when Anaconda3 was installed, the newly created tensorflow environment is based on Python3.6. Then enter:

activate tensorflow  

The tensorflow environment can be activated, and deactivate tensorflow can be deactivated.

5. Install Tensorflow

In the activated tensorflow environment state, enter:

pip install tensorflow-gpu

The latest version will be installed automatically (currently the latest version is 1.12.0/October 9, 2018, do not install the latest version, there will be incompatibility problems (I installed 1.10), enter:

pip install tensorflow-gpu==1.10.0

(support CUDA8.0 and Python3.6) to install;

To uninstall specific tensorflow, enter:

pip uninstall tensorflow-gpu==1.10.0

After the installation, my pip version is 9.0.1, and the latest version is 19.0.3, so it is not necessary to upgrade.

To upgrade to the latest version by default enter:

python -m pip install --upgrade pip

Upgrade to the specified pip version (11.0.1) input:

python -m pip install --user --upgrade pip==11.0.1


 

6. Test Tensorflow

In the activated tensorflow environment state, enter python, enter python directly on the command line, and then enter:

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

print(sess.run(hello))

如果正常输出Hello, TensorFlow!,则为安装成功。

7. Anaconda Navigator

Find Anaconda Navigator under Anaconda3 (64bit) in the start directory and open it.

There is a drop-down box on Applications on in the middle, select tensorflow, and then download and install Jupyter and Spyder, which are used as a visual interface to write python code, operate tensorflow, and write code. lunch indicates that it has been installed, and install indicates that it is not installed.

Eight, some unresolved small problems

After installing Jupyter and Spyder, the web version of Home cannot be opened. After debugging for a long time, I can’t solve it, so I abandon it. . . Switch to PyCharm and use this software to visually edit python code.

 

 

 

 

 

Thank you very much for this blogger's blog, which has given me a lot of help, and the original text link is attached! ! !
--------------------- 
Author: BG2CRW 
Source: CSDN 
Original: https://blog.csdn.net/BG2CRW/article/details/79477092 
Copyright statement: This article Original article for the blogger, please attach the link to the blog post for reprinting!

Guess you like

Origin blog.csdn.net/summer_xj1/article/details/89006509