Macbook远程连接ubuntu服务器jupyter

文章描述了如何在服务器上安装JupyterNotebook,生成配置文件和密码,然后修改配置以允许远程访问。过程中遇到了`passwd`模块安装失败的问题,但通过使用`ipython`和`notebook.auth`模块成功生成了密码。最后,虽然尝试配置了不允许自动打开浏览器和启用远程访问,但未能成功。
摘要由CSDN通过智能技术生成

标题

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

不成功。。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值