pytorch部署到jupyter中

pytorch部署到jupyter中

在这里插入图片描述
在安装Aconda的同时,会将jupyter notebook一起安装,不过这里的jupyter notebook是base中的jupyter notebook二不是pytorch中的jupyter notebook,因此并不能在此jupyter notebook运行torch包。
base中的jupyter:
在这里插入图片描述

两种解决方案

一、base中重新安装pytorch
二、pytorch中安装jupyter notebook
这里选择第二种方法
首先

conda activate pytorch

进入到pytorch环境中去

在这里插入图片描述
在pytorch环境中看包

conda list

在这里插入图片描述
没有我们需要的包,因此输入命令,进行下载jupyter

conda install nb_conda_kernels

进行下载
下载完成后输入命令:

jupyter notebook

打开jupyter notebook
注:我再输入的时候出现了一些无法定位的提示,但是我的电脑没有影响使用jupyter,还是可以使用jupyter并且可以import torch
在这里插入图片描述
点击确定,就可以来到jupyter notebook的页面了

在这里插入图片描述

让我们来验证一下

在这里插入图片描述
成功!!!
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45527999/article/details/124574230
今日推荐