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 配置
- Ctrl+shift+P 打开命令输入框
- Jupyter: 创建新的空白jupyter 笔记本
- Jupyter: 指定本地或着远程Jupyter服务器的连接–现有–填入http://192.168.1.xxx:8888/lab?token=ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4然后右下角会提示重vscode,重启后,就可以创建一个笔记本用了
插件Build 失败的方法
https://blog.csdn.net/weixin_46088071/article/details/107712775
插件安装
必备两条指令
pip install npm
conda install -c conda-forge nodejs