Jupyter notebook配置远程访问
创建一个登录密码
Python 3.8.5 (default, Sep 4 2020, 07:30:14) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> from notebook.auth import passwd >>> passwd() Enter password: Verify password: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$XXXXXXXXXXXXXXzGK1uVQ'
输入两边密码后复制密文
导出配置文件
jupyter notebook --generate-config
修改配置文件
vim /导出位置/.jupyter/jupyter_notebook_config.py
添加以下内容保存:
c.NotebookApp.ip = '*' //允许访问的ip c.NotebookApp.password = '你创建的密码' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 //默认端口 c.IPKernelApp.pyplot = 'inline' c.NotebookApp.allow_remote_access = True //是否开启远程访问
启动Jupyter notebook并远程登录
jupyter notebook --allow-root [W 09:48:30.868 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended. [I 09:48:30.869 NotebookApp] 端口 8888 已经被站用, 请尝试其他端口. [I 09:48:31.004 NotebookApp] JupyterLab extension loaded from /root/anaconda3/lib/python3.8/site-packages/jupyterlab [I 09:48:31.004 NotebookApp] JupyterLab application directory is /root/anaconda3/share/jupyter/lab [I 09:48:31.008 NotebookApp] 启动notebooks 在本地路径: /home/luz/桌面 [I 09:48:31.008 NotebookApp] Jupyter Notebook 6.1.4 is running at: [I 09:48:31.009 NotebookApp] http://XXXX:8889/ [I 09:48:31.009 NotebookApp] 使用control-c停止此服务器并关闭所有内核(两次跳过确认).
=========================================================================================
3.18补充:
反向代理后的互联网访问提示
Blocking Cross Origin API request for /api/XXX
错误原因:未配置跨域访问
c.NotebookApp.allow_origin = '*'