2022.9.17 Download anaconda (configure python environment) + download VSCode (editor) + download pytorch (Python machine learning library)

The installation and basic use of Python+Anaconda+PyCharm [suitable for completely zero-based] not only teaches you how to install, but also tells you why it is installed like this

1. Three basic concepts

1. Interpreter: Generally speaking, installing python is to install a python interpreter (compilation role).

2. Editor: used to edit python code (edit role).

3. pip (package install for python) library management tools/functions: Python3.4 and later versions come with pip tools.

Recommended installation solution: anaconda+VSCode/pytorch

2. Introduction to anaconda

1. On the left tab of anaconda, environments, you can manage existing packages or download unexisting packages.

2. Point 1 answers the reason why the following commands I saw in the blog [1] can succeed:

conda create -n tensorflow2 python=3.7

The code creates a python3.7 environment called "tensorflow2".

[1] Tensorflow installation steps (CPU version, Anaconda environment, Windows10)

3. The video also talks about the solution if jupyter notebook cannot be opened.

During our studies, we found a website " Liao Xuefeng's Official Website ", which I believe will be helpful to me.

---------------------------------------------------------------------------------------------------------------------------------

Anaconda+VScode configuration and installation

Zhihu [Installation Tutorial] Anaconda + VSCode

 1. Anaconda’s Python sub-environments are all in the installation path anaconda3\envs, where you can create sub-environments one by one. It is best to create different sub-environments for different projects to avoid package dependencies between different projects being destroyed. The code is the same as in the blog [1], as follows:

conda create -n env_name python=version_number

 The activation environment code is as follows:

activate env_name 

 2. VSCode installation

 3. Commonly used management instructions can be seen in the Zhihu blog above

---------------------------------------------------------------------------------------------------------------------------------

pytorch installation

 1. What is pytorch

The predecessor of Pytorch is torch. Due to the popularity of python, torch has been developed into a python package, so it is called pytorch. Pytorch is a numpy-based python scientific computing package. It is a deep learning platform. Deep learning practitioners can use this package to complete deep learning related python programming.

Pytorch depends on two programs, cuda (also known as cuda toolkit) and cudnn (cuda neural network), and these two programs depend on NVIDIA drivers. So installing pytorch requires three steps: ① first install or update the NVIDIA driver in the computer, ② install the two programs cudatookit and cudnn, ③ use pip install or conda install to install the pytorch package in one of your environments.

2. Install/Update NVIDIA Drivers

 Open the NVIDIA Geforce website , as shown in the figure below, there are two ways to download and install the NVIDIA driver.

 I chose the first method: download GeForce Experience, this software can help me download the driver automatically. 

3. Install cuda (cuda toolkit) and cudnn (cuda neural network)

3.1 The role of these two programs

CUDAToolkit is a software toolset developed by NVIDIA for parallel computing on NVIDIA's GPUs. CuDNN (CUDA Deep Neural Network library) is a library provided by NVIDIA for deep neural network (DNN) acceleration. It is part of CUDAToolkit, optimized for deep learning tasks.

3.2 Install cuda toolkit

① After installing/updating the NVIDIA driver, open the NVIDIA driver panel, and you can see that the driver version has also been updated.

② Then open the CUDA Toolkit official website , the second table of this website gives the corresponding relationship between CUDA toolkit and NVIDIA driver. It can be seen that my driver version 536.40 is relatively high, and it supports a high version of CUDA Toolkit. I chose to download the CUDA Toolkit version of CUDA 11.6 because I don't need a very high version of the CUDA Toolkit.

③Open the official website of CUDA Toolkit , search such as 11.6 in the search bar, and the following search results will pop up: 

④ After clicking the search result to enter, select windows, x86_64, 10, exe(local), and click Download.

⑤ After downloading, it is an .exe file, just run it and follow the prompts to install step by step.

3.3 install cudnn 

①Open the cuDNN download website , here I choose the cudnn download for version 11.x.

② After downloading, you will get a compressed package. After decompressing the compressed package, copy some files to the path of cuda toolkit. For this step, see this Zhihu blog .

 4. Install pytorch

①Look at this table (the version correspondence between torch and pythpn), my python version is 3.9, so I choose torch1.12 (the torch here is pytorch)

②Open pytoch official website , click previous pytorch versions

③ You can use conda or pip, and then copy the corresponding instructions to install.

 5. Verify

Guess you like

Origin blog.csdn.net/weixin_45338109/article/details/126906494