jupyter notebook (Lab) 切换虚拟环境、无kernel、服务器部署、conda插件安装解决汇总

jupyter 安装

安装Jupyter notebook,建议直接用Anaconda安装,安装时记得勾选环境配置
用着用着感觉miniconda 真好用

jupyter 启动

jupyter notebook

jupyter 无ipykernel虚拟环境 解决方法

1.在你想要的使用的环境里面安装

conda install ipykernel

ps: 切换环境的命令是

activate  <env-name>

<env-name> 是你自己的环境名字

2.重启jupyter notebook

如果没有就进行第三步

3.在你想要的环境里面使用

python -m ipykernel install --user --name <env-name> --display-name "env-name"
简单使用

然后在python3的python.exe所在目录下执行(我觉得关键点)

 python -m ipykernel install

可以添加命令为kernel指定名字(接上面)

--name kernelname

<env-name> 是你自己的环境名字

重启

在这里插入图片描述

删除多余的内核

conda activate base # 在 base 环境下进行
jupyter kernelspec list
jupyter kernelspec remove kernel_name # 可以连写多个

jupyter notebook 配置

服务器部署

step1 生成配置文件

jupyter notebook --generate-config

对应会生成jupyter_notebook_config.py 文件

step2 配置密码

使用jupyter notebook password 配置密码(限jupyter 5.0 以上 现在估计都是)
显示

$ jupyter notebook password
Enter password:  ****
Verify password: ****
[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json

step3配置文件

# Set ip to '*' to bind on all interfaces (ips) for the public server
# 设置可以访问的ip * 是所有
c.NotebookApp.ip = '*'
# 自动打开浏览器
c.NotebookApp.open_browser = False

# It is a good idea to set a known, fixed port for server access
# 设置打开的端口号
c.NotebookApp.port = 9999

jupyter 插件安装

conda install -c conda-forge jupyter_contrib_nbextensions
conda install -c conda-forge jupyter_nbextensions_configurator

conda 插件

演示图

在这里插入图片描述

安装命令

# 主要还是用来识别其他环境
conda install nb_conda_kernels

第二种没看懂区别,先用第一种吧

conda install nb_conda
#如果你以前有5.3的jupyter notenook 内核,那么你还需要下一句to enable the JupyterLab server extension:
jupyter serverextension enable --py jupyterlab --sys-prefix

jupyter Lab 配置

服务器器配置

配置生成

jupyter lab --generate-config

修改配置

c.ServerApp.allow_remote_access = True  #设置允许远程访问
c.ServerApp.local_hostnames = ['192.168.1.xxx']  #设置主机名,这儿我用域名也可以
c.ServerApp.root_dir = 'E:\\'  #设置启动后的jupyterlab的笔记文件根目录
c.ServerApp.token = 'ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4' # 设置token 方便vscode配置jupyter

c.ServerApp.notebook_dir = 'C:\\Users\\abcdefg\\Desktop' # 设置默认工作路径

vscode 配置

  1. Ctrl+shift+P 打开命令输入框
  2. Jupyter: 创建新的空白jupyter 笔记本
  3. Jupyter: 指定本地或着远程Jupyter服务器的连接–现有–填入http://192.168.1.xxx:8888/lab?token=ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4然后右下角会提示重vscode,重启后,就可以创建一个笔记本用了

引自 https://www.cnblogs.com/qq-757617012/p/14412569.html

插件Build 失败的方法

https://blog.csdn.net/weixin_46088071/article/details/107712775

插件安装

必备两条指令

pip install npm
conda install -c conda-forge nodejs

Powershell中激活Anaconda环境无效的解决办法

https://blog.csdn.net/weixin_43681778/article/details/109206108?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-5&spm=1001.2101.3001.4242

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值