Mac computer configuration Li Mu deep learning environment [pytorch version] using vscode

The first step is to install the Pytorch environment on the M1 chip.

Install Miniforge

Open the terminal on Mac (How to start the terminal on a Mac computer? Open the launch pad and search for the terminal)
and install the package management tool Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

If you encounter an error

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

You need to run the following command and then install Homebrew. The reason is that it is blocked and the port needs to be configured.

export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:789

After successfully installing Homebrew, restart the terminal (how to start the terminal on a Mac? Open the launch pad and search for the terminal) and install miniforge directly.

brew install miniforge

After the installation is complete, initialize conda for the terminal:

conda init zsh

Create a virtual environment

Create a virtual environment named pytorch_env using python 3.8

conda create --name pytorch_env python=3.8

Activate virtual environment

conda activate pytorch_env

After activation is successful, you will see the following interface
Insert image description here

Install PyTorch

Use the conda command to install pytorch and torchvision

conda install -c pytorch pytorch torchvision

The second step is to download the Li Mu Jupyter file.

Enter the course homepage: https://courses.d2l.ai/zh-v2/Click
on the Jupyter Notepad in the upper right corner to download.
Insert image description here

The third step is to configure vscode

Search vscode and enter the vscode official website: https://code.visualstudio.com/
to download and install the mac version of vscode

Configure vscode: Click the virtual environment below the settings button on the right side of the picture below: pytorch_env
Insert image description here

If it is a newly downloaded vscode, you need to manually open the following panel
Insert image description here

Activate the virtual environment in the lower panel

conda activate pytorch_env

Then use conda to install Li Mu’s special d2l package

conda install d2l

As shown in the figure below
Insert image description here
, then open a downloaded jupyter file and run it

Insert image description here

reference

【1】https://zhuanlan.zhihu.com/p/394514049

Guess you like

Origin blog.csdn.net/shizheng_Li/article/details/130540182
Recommended