Use Miniconda line of code configuration Pytorch environment

Installation miniconda

Similarly anaconda installation, only need to download the corresponding anaconda. I mainly do not need anaconda own scientific computing package, so we chose miniconda

  1. Tsinghua mirror station, download miniconda

    # 清华镜像站地址
    https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
  2. Installation miniconda, first enter the installation files folder

    bash Miniconda3-latest-Linux-x86_64.sh

    During the installation, it will ask whether to agree to the license, enter yes, then let you choose where to install, as no special requirements, direct the transport, installed in the default location.

Set mirror source

  • By modification in the user directory .condarc file:

    channels:
      - defaults
    show_channel_urls: true
    default_channels:
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
    custom_channels:
      conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
      simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  • If the file does not exist, you can create a direct, further modification

    touch .condarc

Specific installation depth learning environment

Installation tensorflow

  • tensorflow-gpu version

    # 使用哪个tensorflow版本都行
    conda create -n tf-gpu python=3.6 tensorflow-gpu
    
    # 比如使用tensorflow1.13版本
    conda create -n tf-gpu python=3.6 tensorflow-gpu=1.13
  • tensorflow-cpu version

    conda create -n tf-cpu python=3.6 tensorflow
  • Description:

    • create: to create a virtual environment in conda in
    • -n: behind the tf-gpu is the name of the virtual environment

Installation keras

  • hard

    conda install keras

Installation Pytorch

  • Pytorch-gpu version

     conda create -n pyt-gpu python=3.6 pytorch torchvision cudatoolkit=10.1 -c pytorch
  • pytorch-cpu version

     conda create -n pyt-cpu python=3.6 pytorch-cpu torchvision-cpu -c pytorch

Guess you like

Origin www.cnblogs.com/tangzz/p/12111065.html