Centos 安装jupyter与修改笔记目录和实现远程访问

一、安装命令

pip3 install jupyter

二、创建配置文件

jupyter notebook --generate-config
[root@fangangmysql217 /root/.pip]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

 三、修改配置

vim /root/.jupyter/jupyter_notebook_config.py

远程访问与密码设置以及目录设置 需要修改的内容

## notebook服务会监听的IP地址.
c.NotebookApp.ip = '*'

## Hashed password to use for web authentication.
#  
#  To generate, type in a python/IPython shell:
#  
#    from notebook.auth import passwd; passwd()
#  
#  The string should be of the form type:salt:hashed-password.
c.NotebookApp.password = u'sha1:dd9287a1a0ab:071ba1257bfcbb7c4ec63e6872a98081c6d2c201'

## The port the notebook server will listen on (env: JUPYTER_PORT).
c.NotebookApp.port = 8888


## 用于笔记本和内核的目录。
c.NotebookApp.notebook_dir = '/root/樊纲/jupyter_code'

## Whether to open in a browser after starting. The specific browser used is
#  platform dependent and determined by the python standard library `webbrowser`
#  module, unless it is overridden using the --browser (NotebookApp.browser)
#  configuration option.
c.NotebookApp.open_browser = False

 生成一个sha1的密钥

from notebook.auth import passwd
passwd()
# 此时需要输入两次密码(一次设置,一次确认),然后生成sha1的密文,拷贝下来。
# Enter password: ········
# Verify password: ········
# sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

四、启动jupyter

jupyter notebook --allow-root
[root@fangangmysql217 /root/.pip]# jupyter notebook
[I 09:19:46.551 NotebookApp] 把notebook 服务cookie密码写入 /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 09:19:47.005 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[C 09:19:47.007 NotebookApp] 不建议以root身份运行.使用--allow-root绕过过.
[root@fangangmysql217 /root/.pip]# jupyter notebook --allow-root

五、打开jupyter

jupyter主机IP+端口8888

http://172.168.1.217:8888/login

输入配置时设置的密码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值