标题
1 需要在服务器端安装jupyter NoteBook
pip install jupyter
2 通过配置文件进行相应参数的设置
jupyter notebook --generate-config
记录配置文件位置(命令行输出内容如下):
Writing default config to: /home/user_name/.jupyter/jupyter_notebook_config.py
3 生成密码(后续写配置文件、登录Jupyter notebook需要,需要输入一大堆东西)
在服务器适当的python环境下打开python,在Python命令行输入:
>>> from IPython.lib import passwd
>>> passwd()
无法载入passwd,安装失败,我佛了。
尝试另一种方法:在合适的python环境下输入ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$XFBoZKEecDXdULSKn65BOQ$cyIuBRa4MMu7hwv5gmfuJ9ompcJMftTiU8yQTOjTAVA'
记录秘钥。
4 创建一个服务器配置
(2023_phoebe) liujunhui2@taurus:~$ ipython profile create nbserver
[ProfileCreate] Generating default config file: PosixPath('/home/liujunhui2/.ipython/profile_nbserver/ipython_config.py')
[ProfileCreate] Generating default config file: PosixPath('/home/liujunhui2/.ipython/profile_nbserver/ipython_kernel_config.py')
5 修改默认配置文件
# vim ~/.jupyter/jupyter_notebook_config.py
vim home/liujunhui2/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'
c.NotebookApp.password = u'XXX:xxxxxxxxxxx(上一步生成的密文, 直接复制过来就行)'
c.NotebookApp.port = 9999 #随便指定一个闲置端口,默认是8888
c.NotebookApp.open_browser = False #禁止自动打开浏览器
c.NotebookApp.allow_remote_access = True #远程访问
c.NotebookApp.allow_root = True
不成功。。。。。