服务器安装Jupyter notebook,并远程访问使用
使用服务器安装jupyter并远程使用的方法较简单,可以按照以下几步进行:
1、安装jupyter
在带有python环境的服务器上执行命令:pip install jupyter
安装过程极其缓慢,中间可能数次会出现链接断开,没办法,重新开始就行了
2、生成配置文件
(1)在linux下执行命令: jupyter notebook --generate-config
(2)打开该文件,设置:
# The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = u'/home/user1/jupyter'
## Whether to open in a browser after starting. The specific browser used is
c.NotebookApp.open_browser = False
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '*'
## The port the notebook server will listen on.
c.NotebookApp.port = 8889
3、 设置密码:
执行jupyter notebook password,然后输入密码即可
4、开始访问:jupyter notebook 即可
/home/user1# jupyter notebook --allow-root
[W 16:05:01.514 NotebookApp] Collisions detected in /root/.jupyter/jupyter_notebook_config.py and /root/.jupyter/jupyter_notebook_config.json config files. /root/.jupyter/jupyter_notebook_config.json has higher priority: {
"NotebookApp": {
"password": "'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' ignored, using 'sha1:bb06981a3bde:eec0fe3d08e2f7717e6323ccf2d5df1fba6eb315'"
}
}
[W 16:05:02.349 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:05:02.365 NotebookApp] Serving notebooks from local directory: /home/user1
[I 16:05:02.365 NotebookApp] 0 active kernels
[I 16:05:02.365 NotebookApp] The Jupyter Notebook is running at:
[I 16:05:02.366 NotebookApp] http://[all ip addresses on your system]:8889/
[I 16:05:02.366 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 16:05:13.985 NotebookApp] 302 GET / (192.168.1.109) 0.89ms
[I 16:05:13.992 NotebookApp] 302 GET /tree? (192.168.1.109) 1.44ms