current position:Home>【Conda】python environment setup , windows+conda+jupyter+pytorch (English Version)

【Conda】python environment setup , windows+conda+jupyter+pytorch (English Version)

2022-08-06 06:32:57little girl

Install anaconda

  1. Enter the official website of Anaconda:https://www.anaconda.com/
    在这里插入图片描述
  2. Left click download
  3. Double left click the file after downloading,the result should be:
    在这里插入图片描述
  4. Keep clicking next util this part:
    Check add anaconda3 to my PATH environment varible
    在这里插入图片描述
  5. Installation done
    在这里插入图片描述7. Check whether anaconda has been successfully installed:
    Search cmd on the left bottom of screen
    在这里插入图片描述
    open cmd, type conda, conda has been successfully installed if it gives you like this:
    在这里插入图片描述

Create conda environment

  1. Create a new environment named tutorial (setup python version as 3.6)
    conda create -n tutorial python=3.6
    
    Successfully create:在这里插入图片描述

Activate environment

  1. Activate environment tutorial
    conda activate tutorial
    
    Successfully activate:
    在这里插入图片描述

Install jupyter notebook

  1. install
    conda install jupyter
    
  2. open jupyter notebook
    jupyter notebook
    
    在这里插入图片描述

Install pytorch

  1. Enter the official website of pytorch:https://pytorch.org/
  2. Choose the version you need, then copy the installation command.
    在这里插入图片描述4. In cmd, activate the environment you would like to install pytorch into. Then enter the command you copied before.Here I use cpu version pytorch for an example:
    conda install pytorch torchvision torchaudio cpuonly -c pytorch
    
  3. Check wether pytorch has been successfully installed:
    import torch
    torch.__version__
    
    The result should be like this if successfully installed:
    在这里插入图片描述

Replace channel(If need)

Mirror channel is used when you can’t download some package due to the fire wall of China.

  1. Create condarc file:
    conda config --add channels r
    
  2. The condarc file should be in : /home/user/.condarc
  3. Find the file and open it, the content of the file should be like this:
    在这里插入图片描述
  4. Use the content below to replace the content of condarc file:
    channels:
      - defaults
    show_channel_urls: true
    channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
    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
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
      - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    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
    
    
    在这里插入图片描述

copyright notice
author[little girl],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/218/202208060519291335.html

Random recommended