PyTorch deep learning entry notes (1) PyTorch environment configuration and installation

Time:2022-9-16

@[Toc]

OS:ubuntu 20.04 (virtual machine)

1. Tool installation

1.1 Anaconda installation

First install Anaconda, I went to the mirror site of Tsinghua University to download, the version is
`
Anaconda3-5.2.0-Linux-x86_64.sh
`
Refer to this CSDN blog to install it.
Installation successful test:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
First create a virtual environment:

conda create -n pytorch python=3.6

PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
enter

source activate pytorch

activation environment

1.2 Pytorch installation

Enter the official website and select the appropriate version to install, because I am using the ubuntu20.04 virtual machine, which does not support CUDA, so I chose the CPU:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation

Select the appropriate version and copy Run this Command: to install it (not recommended because the download speed is slow).
The installation process may be slow, you can use the following command (recommended)'

pip3 --default-timeout=1000 install --index-url https://mirrors.aliyun.com/pypi/simple torch==1.10.1+cpu torchvision==0.11.2+cpu torchaudio==0.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html

Note: First enter the created Pytorch virtual environment, and then enter the command to install.
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
Test after installation:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation

Second, the editor installation

2.1 Pycharm installation

The official download address is: https://www.jetbrains.com/pyc…
Choose the free community edition installation:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
Download it, unzip it, put it in a suitable folder, and then add environment variables

gedit .bashrc

On the bottom line enter:

# pycharm
alias pycharm="sh /home/jc-cao/app_download_address/Pycharm2021/pycharm-community-2021.3.1/bin/pycharm.sh"

Note: Change the above path to your own pycharm installation path
Then make the configuration take effect

source .bashrc

Type this in the terminalpycharmopen the software
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
Next create a project named learn_pytorch:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
Select the interpreter as the python interpreter of the virtual environment named pytorch created earlier

2.2 Jupyter installation

In the pytorch virtual environment, enter

conda install nb_conda

Install jupyter:
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
After installation, enterjupyter notebooktest
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation
Create a new notebook in jupyter and use the python interpreter of the pytorch virtual environment to import the torch package for use.
PyTorch deep learning entry notes (1) PyTorch environment configuration and installation

  • For more technical articles and learning materials, please pay attention to my public account: [Integrated Circuit Design Tutorial]
  • Unification of the whole platform: [Snow Fish]