Ubuntu 搭建jupyter web server,Jupyter notebook远程访问
-
ubuntu20.04安装anaconda3
-
创建虚拟环境,安装jupyter notebook
| conda create -n jupter python=3.7 |
| Proceed ([y]/n)? 输入y,回车 |
| conda activate jupter |
| |
| conda install jupyter notebook |
| Proceed ([y]/n)? 输入y,回车 |
- Jupyter notebook 配置
| 1. 生成配置文件 |
| jupyter notebook --generate-config |
| |
| Writing default config to: /home/chengjialin/.jupyter/jupyter_notebook_config.py (配置文件所在路径) |
| |
| 2. 创建密码 |
| 使用python中的passwd()创建密码,终端输入ipython打开ipython并输入: |
| |
| In [1]: from notebook.auth import passwd |
| In [2]: passwd() |
| Enter password: ****** |
| Verify password: ****** |
| Out [2]: 'sha1:...' |
| |
| 复制Out [2] 显示的密码('sha1:...' 包括引号)。 |
- 修改jupyter notebook的配置文件
| vim ~/.jupyter/jupyter_notebook_config.py |
| |
| 在该文件中做如下修改或直接在文件尾端添加: |
| |
| c.NotebookApp.allow_remote_access = True |
| c.NotebookApp.ip='*' |
| c.NotebookApp.password = u'sha:..' |
| c.NotebookApp.open_browser = False |
| c.NotebookApp.port =8888 |
- 设置notebook中文显示
| 查看环境变量: |
| (py38) ubuntu@VM-0-3-ubuntu:~$ env |
| 可以看到:LANGUAGE=en_US.utf8: |
| |
| 查看是否安装有中文语言包: |
| (py38) ubuntu@VM-0-3-ubuntu:~$ locale -a |
| C |
| C.UTF-8 |
| en_US.utf8 |
| POSIX |
| 没有就安装: |
| (py38) ubuntu@VM-0-3-ubuntu:~$ sudo apt-get install language-pack-zh-hans |
| Do you want to continue? [Y/n] 输入y,回车 |
| |
| 修改locale文件配置 |
| (py38) ubuntu@VM-0-3-ubuntu:~$sudo vim /etc/default/locale |
| 按i键,删除当前内容,再输入以下内容 |
| |
| |
- 启动jupyter notebook
| 重启shell,再次激活jupter环境,运行jupyter notebook |
| 终端输入: |
| jupyter notebook |
| |
| 或使用nohup后台运行 jupyter notebook: |
| nohup jupyter notebook >~/jupyter.log 2>&1 & |
- 远程访问jupyter notebook
| 本地浏览器输入http://(服务器地址):(配置文件中设定的端口); 假设服务器地址为192.168.1.129,配置的端口为8888,这里的浏览器输入地址应为http://192.168.1.129:8888; 即可访问jupyter notebook。 |
| |
参考:
https://cloud.tencent.com/developer/article/1918314
https://www.zhihu.com/tardis/zm/art/87403131?source_id=1003
https://www.jiguiquan.com/?p=4078
https://zhuanlan.zhihu.com/p/38612108
https://blog.csdn.net/m0_64087341/article/details/133562004
https://www.zhihu.com/tardis/zm/art/87403131?source_id=1003
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
2021-07-13 Jenkins详细教程