windows10 installation tensorflow2.0-GPU and Cupy (without engaging CUDA + cudnn)

0. Introduction

  This summer bought a 1660ti game this school python, later found to run some of the large amount of data codes and depth of learning time is too slow, then think about the installed GPU version, read the information on the Internet to engage in a few days, but also CUDA is the cudnn, Suman does not say Bahrain has a variety of error, found that as the last update anaconda and tensorflow, and now just use anadonda command line to complete. (Installed after the virtual environment, direct see 4.2 )

  

1. Install anaconda

  This part of the difficulty of nothing, just pay attention to two points:

    1. go to the official website to download https://www.anaconda.com/distribution/ , rather than go to Tsinghua mirror sites (has not been updated for a long time), the official website at Qinghua slower than that, but believe me it's worth it.

    2. When the installation recommendations directly to the two hooks are chosen (other online tutorials are recommended not to check and then add the PATH manually, but I found no problem with the direct hook, then add PATH but there are all kinds of problems)

 

 

    # If the computer has been previously installed python, it recommended that you uninstall and then install anaconda, so to avoid a lot of problems

 

    This step is done you will have a lot of pre-installed package of base environment, including pandas and numpy, enough for beginners to do a lot of things.

 

2. For Tsinghua source

  Although it says anaconda installation package do not go up and down Tsinghua University, but with mirror sites to download and update python package or can (can a lot faster). Open the CMD, enter the copy on the line

            

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

            conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 

            conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

            conda config --set show_channel_urls yes

 

3. Create an additional virtual environment

  Look at the online tutorials from the time did not understand this point what is the use, processing error found after a lot of this is to avoid dependencies version conflicts. For example, you download on the official website anaconda, comes with the base environment is python3.8, python3.6 installed and tensorflow is recommended, it requires various dependencies also python3.6 era, installed directly in the base environment, the need the latest package was originally downgrade may affect other packages, the latest feature is not used anymore.

  So create a virtual environment can be completely avoided dependencies conflict, when switching requires the use of tensorflow come on the line.

  3.1 Open CMD (if you put anaconda installed in the C drive, we recommend using an administrator to run, can be avoided in advance permission error) , type:

            conda create -n env_gpu python=3.6 

 (Env_gpu you to play virtual environment's name, according to personal preference trying to be difficult, mostly online or call tensorflow env_tf2, I am here to call env_gpu because I need to use this environment to run gpu acceleration tasks: tensorflow-gpu and cupy)

 

 

   Press Enter y, anaconda will have to install some packages (source after the change is very fast)

 

4. Installation tensorflow-GPU in a virtual environment (for machine learning) and cupy (GPU-accelerated version of numpy)

    4.1 First activate the virtual environment:

         conda activate env_gpu

         (Cmd entire portion 4 are respectively turned off, with the same, if the hand sliding off, will once again activate the virtual environment)

    

 

    Can be seen in front of a parenthesis environment where the show

   

      

     4.2. Installing and cupy tensorflow-gpu

            conda install tensorflow-gpu=2.0.0

            conda install cupy

            (Line by line to)

 

 

 

          You can see anaconda automatically installs the matching version of cuda and cudnn, you do not have to head loss Sheriff's website to download, but also to avoid versioning issues to worry about.

      4.3 installation spyder, jupyter notebook

          Because a separate virtual environment we have created in the third step, the original base of spyder environment and jupyter notebook is not common, so a manual installation on the line in this environment:

          conda install spyder

          conda install jupyter

 

          After the installation you can search in the Start menu spyder, (anaconda) at the end of the base is under spyder environment, (env_gpu) at the end of a spyder in this environment.

 

5. test it 

    5.1 Open spyder (env_gpu)

    5.2 Type some test code

 

    5.3 cupy also import test

 

 

 

     Are not being given, you're done!

 

 

 

 

Guess you like

Origin www.cnblogs.com/xxxms/p/11826388.html