linux安装jupyterlab方法

2022-06-21 11:59:53

1. pip install jupyterlab

2. 设置密码获得秘钥

zbs@zbs-NF5468M5:$ ipython
Python 3.6.2|Continuum Analytics, Inc.|(default, Jul 20 2017, 13:51:32)Type'copyright','credits' or'license'for more information
IPython 7.16.1-- An enhanced Interactive Python.Type'?'for help.

In[1]:from IPython.lib import passwd

In[2]: passwd()
Enter password: 
Verify password: 
Out[2]:'sha1:edfc4e9a80a8:6c565e5bd4499e818d4005808898b383d648cf08'#后面要用

3.生成配置文件

zbs@zbs-NF5468M5:$ jupyter notebook--generate-config
Writing default config to:/home/zbs/.jupyter/jupyter_notebook_config.py

4. 修改配置文件

vim /home/zbs/.jupyter/jupyter_notebook_config.py中添加

c.NotebookApp.ip ='*'
c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8889
c.NotebookApp.password ='sha1:edfc4e9a80a8:6c565e5bd4499e818d4005808898b383d648cf08'#输入上面加密后得到的密文
c.ContentsManager.root_dir ='/data'

5.运行

jupyter-lab
网址http://192.168.6.141:8889

6.添加新的环境

source activate your-envs-name
conda install ipykernel
python -m ipykernel install --user --name your-name#your-name 你想在jupyter-lab中显示的环境名字

报错
ImportError: cannot import name ‘generator_to_async_generator’
解决
pip uninstall -y ipython prompt_toolkit
pip install ipython prompt_toolkit

报错
ModuleNotFoundError: No module named ‘IPython.core’
解决
pip install ipython --ignore-installed ipython

#centos安装的遇到浏览器打不开远程服务器jupyter-lab

防火墙开放8889端口

firewall-cmd --zone=public --add-port=8889/tcp --permanent
systemctl restart firewalld.service
iptables -L -n
  • 作者:qq_34496674
  • 原文链接:https://blog.csdn.net/qq_34496674/article/details/108223336
    更新时间:2022-06-21 11:59:53