Installation of Cudnn and Pytorch

  • Search cmd with the win key, right-click to select the administrator, and run the command: conda install pytorch torchvision cuda100 -c pytorch Note: This is the pytorch version of CUDA 10.0. Note that it must be in administrator mode. Don’t just run and run stupidly, read on first

  • How to get different versions of commands? Search the pytorch official website, select the corresponding version, and the relevant commands will be automatically given. Another: To download previous versions, please visit https://pytorch.org/get-started/previous-versions/

  • Command to run, see the next step

  • If you have not crossed the wall, the download speed will be very slow. Unfortunately, this command needs to install a package of about 1.4G, so CondaHTTPError usually occurs. For the solution, please refer to my other blog: CondaHTTPError in conda install command

       However, the point is here, don't think you can execute commands after you configure the things mentioned above. The prerequisite for downloading some packages in this command is that cudnn must be configured

  • There are various versions available on cudnn's official website. You must download them according to the version of cuda you have installed. Visit https://developer.nvidia.com/rdp/cudnn-download and register an account to log in. Mine is the version corresponding to cuda10.0: Link: https://pan.baidu.com/s/1lI0oW28a0AULNcWxRCEFNA Extraction code: e43t 

  • After downloading, it is a compressed package, unzip it, you will see three folders

  • Then, we need to copy these three folders to the CUDA installation directory. Where is the installation directory of CUDA? See my other blog: CUDA10.0 installation under Win10 system . Note that these three folders also exist in the CUDA installation directory, so our copy here refers to copying the things in the three uncompressed folders to the corresponding CUDA directory

At this point, cudnn installation is over


  • Then we can execute the pytorch installation command corresponding to cuda10.0. This process may take a while. If the installation is successful, it will prompt three done. I don’t have a screenshot. But I executed the command again, it will prompt me that all the packages have been installed, so far the installation command runs successfully.

  • Finally, we can go to the guide package for testing
    >>> import torch #导入torch包
    >>> torch.__version__  #d查看torch版本
    '1.2.0'
    >>> import torchvision #导入torchvision
    >>> torchvision.__version__ #查看torchvision版本
    '0.4.0'
    >>> torch.cuda.is_available() #查看gpu是否可用
    True
    >>> torch.cuda.device_count() #查看gpu个数
    1
    >>> torch.cuda.current_device() #查看当前gpu
    0
    >>> torch.cuda.get_device_name(0) #查看当前设备名称
    'GeForce 940M'
  •  The final result picture, don’t envy my successful installation hahahaha

Guess you like

Origin blog.csdn.net/qq_40923413/article/details/108071388