配置jupyterlab远程访问及其常见问题解决,内核修改


jupyterlab:

  • pip:pip install jupyter jupyterlab
  • remote access:
    1. 生成配置文件: jupyter notebook --generate-config
    2. 生成口令,访问时输入验证:
      >>>from notebook.auth import passwd
      >>>passwd()
      
    3. 修改配置文件:
      $vim ~/.jupyter/jupyter_notebook_config.py
      
      c.NotebookApp.ip='*' # 就是设置所有ip皆可访问
      c.NotebookApp.password = 'sha1:72... # 刚才复制的那个密文'
      c.NotebookApp.open_browser = False # 禁止自动打开浏览器
      c.NotebookApp.port =8888 #随便指定一个端口
      
    4. 访问:浏览器输入url: http://ip:port/

jupyter notebook调出快捷键:

  • 方法1:在命令模式下,按键盘上 h 键。
  • 方法2:在界面“Help”菜单下,点击“Keyboard Shortcuts”。

jupyter常见问题:

  • jupyter突然奔溃,重新打开,发现之前执行的文件全部丢失,文件恢复到了很久之前的版本
  • 解决方案:
%history -g -f notebook_file.ipynb # 将所有执行历史保存到文件notebook_file.ipynb文件中

https://blog.softhints.com/6-ways-recover-deleted-jupyter-notebook-including-jupyterlab/#step4jupyternotebookrestorecheckpointsession

  • jupyter内核修改,官方手册
    1. 注意是否是conda环境
    2. 安装ipykernel: python -m pip install ipykernel
    3. 新建kernel: python -m ipykernel install --user --name=py39, 如果不定义--name参数的话,默认为python3
    4. 查看kernel: jupyter kernelspec list
    5. 删除: jupyter kernelspec uninstall your_kernel_name


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM