Hands-On Deep Learning - Installation
Q7nl1s admin

EN

We need to set up an environment to run Python, Jupyter Notebook, relevant libraries, and the code required for this book to quickly get started and gain hands-on learning experience.

Install Miniconda

I have already installed conda, so I will not demonstrate this.

Next, execute the following command to create a new conda environment named d2l:

1
conda create --name d2l python=3.9 -y

Now activate the d2l environment:

1
conda activate d2l

Install Deep Learning Framework Pytorch and d2l Package

To use the GPU, first check if your computer has an NVIDIA GPU and has CUDA installed. Then go to the PyTorch official website to get the latest download instructions (choose the one that fits your graphics card). Here I choose CUDA 11.8.

image-20230706215206943

Run the download instructions in the d2l environment.

image-20230706214908816

Seeing done means the process is finished.

Our next step is to install the d2l package:

1
pip install d2l==0.17.6

Download D2L Notebook

Go to: https://zh-v2.d2l.ai/d2l-zh.zip to download.

After downloading, enter the pytorch directory:

1
cd pytorch

Once the installation is complete, we can open the Jupyter Notebook by running the following command (in the Windows command prompt, navigate to the directory where you extracted the book code before running the following command):

1
jupyter notebook

Now you can open it in a web browser: http://localhost:8888 (it usually opens automatically).

Before running the book code, updating the deep learning framework, or the d2l package, always execute conda activate d2l to activate the runtime environment. To exit the environment, run conda deactivate.

image-20230706221515596




CN

我们需要配置一个环境来运行 Python、Jupyter Notebook、相关库以及运行本书所需的代码,以快速入门并获得动手学习经验。

安装 Miniconda

我已经安装好conda了就不演示了

接着执行以下命令创建一个名为 d2l 的新 conda 环境

1
conda create --name d2l python=3.9 -y

现在激活 d2l 环境

1
conda activate d2l

安装深度学习框架 Pytorch 和 d2l 软件包

要使用 GPU 的先查看计算机是否装有 NVIDIA GPU 并已安装CUDA。再去PyTorch官网获取最新的下载指令(根据自己的显卡选择适配的),这边我选择的是 CUDA 11.8 的

image-20230706215206943

d2l 环境下运行下载指令

image-20230706214908816

看到 done 即为结束

我们的下一步是安装d2l

1
pip install d2l==0.17.6

下载 D2L Notebook

跳转到:https://zh-v2.d2l.ai/d2l-zh.zip 下载

下载完后进入 pytorch 目录

1
cd pytorch

安装完成后我们可以通过运行以下命令打开Jupyter笔记本(在Window系统的命令行窗口中运行以下命令前,需先将当前路径定位到刚下载的本书代码解压后的目录):

1
jupyter notebook

现在可以在 Web 浏览器中打开:http://localhost:8888(通常会自动打开)。

在运行书籍代码、更新深度学习框架或d2l软件包之前,请始终执行conda activate d2l以激活运行时环境。 要退出环境,请运行conda deactivate

image-20230706221515596

 Comments
Comment plugin failed to load
Loading comment plugin
Powered by Hexo & Theme Keep
Unique Visitor Page View