动手学深度学习V2——李沐(学习中遇到的问题)

1. no module named d2l

问题描述:from d2l import torch as d2l时候遇到

1.1 方法1,下载d2l包放入环境中

  • 注意,Anaconda安装的jupyter默认python内核是base环境,位置如下:
    在这里插入图片描述
    如果想要使用别的环境,可以搜索如何切换 jupyter 的 python 内核。
  • 当然也可以在jupyter使用的python环境中直接使用pip安装
pip install -U d2l

1.2 方法2,直接在jupyter中安装

!pip install -U d2l

2. No module named ‘matplotlib_inline’

问题描述:使用如下代码时遇到

%matplotlib inline
#是一个魔法函数,可以通过命令行的语法形式来访问

解决:李沐动手学习深度学习from d2l import torch as d2l时No module named ‘matplotlib_inline‘
依然要注意jupyter使用的python内核环境

猜你喜欢

转载自blog.csdn.net/qq_22487889/article/details/127344169