1. no module named d2l
Description of the problem: from d2l import torch as d2l
when encountered
1.1 Method 1, download the d2l package and put it in the environment
- Note that the default python kernel of jupyter installed by Anaconda is the base environment, and the location is as follows:
If you want to use another environment, you can search for how to switch the python kernel of jupyter. - Of course, you can also use pip installation directly in the python environment used by jupyter
pip install -U d2l
1.2 Method 2, install directly in jupyter
!pip install -U d2l
2. No module named ‘matplotlib_inline’
Description of the problem: Encountered when using the following code
%matplotlib inline
#是一个魔法函数,可以通过命令行的语法形式来访问
Solution: Li Mu hands-on learning deep learning from d2l import torch as d2l No module named 'matplotlib_inline'
still needs to pay attention to the python kernel environment used by jupyter