Centos7安装jupyter notebook

###安装python3
#####查看当前python版本

[root@VM-0-12-centos ~]# python -V
Python 2.7.5
安装python3以及检查python3的版本
yum install python3
python3 -V
安装jupyter notebook
pip3 install jupyter

生成配置文件

jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

生成密码,用刚装好的python3就可以了(可能是版本问题,尝试不能成功)

from notebook.auth import passwd
passwd()

命令行生成密码:

jupyter notebook password 
#[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_c                     onfig.json
再次前台启动就会出现哈希密码

最后是修改一下配置文件
password 就是刚才用命令行生成的哈希密码

vim /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.password = 'sha1:8$E18FYIYkGfwYK+270oBdgA$gNYatshZbw8WvcoiwjPKMw'
c.NotebookApp.port = 8888
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.notebook_dir = '/jupyter_notebook'
启动jupyter notebook

前台启动:

jupyter notebook --allow-root

后台启动:

#默认将日志写到当前目录的nohup.out中
nohup jupyter notebook --allow-root &

#不想输出日志可将日志输出到“黑洞”(同时也可将null指定为输出文件)
nohup jupyter notebook --allow-root >/dev/null 2>&1 &

使用后台启动想退出时:
想要退出的话可以查询jupyter notebook占用了哪个进程

ps -aux | grep jupyter

或者是查询端口号8888被哪个进程占用了

netstat -tunlp|grep 8888

然后把找到的进程kill掉就可以了

kill 33650

猜你喜欢

转载自blog.csdn.net/qq_25905159/article/details/108864822
今日推荐