美文网首页
centos下jupyter notebook的安装

centos下jupyter notebook的安装

作者: w_dll | 来源:发表于2020-01-05 11:30 被阅读0次

看网上学习python很多人都在用jupyter,目前也在自己服务器上搭建了一个用来写爬虫及练习python,后来发现jupyter自带命令行工具,有时我连接自己服务器不用xshell,直接在网页上通过jupyter也很方便。

下载

首先确保python的安装,参考

mkdir /home/soft/jupyter && cd /home/soft/jupyter
pip install jupyter

将端口8888 加入防火墙

firewall-cmd --add-port=8888/tcp --permanent
firewall-cmd --add-port=8888/tcp --permanent
firewall-cmd --reload

配置jupyter

查看配置文件地址

jupyter notebook --generate-config --allow-root

进入提示配置文件地址,我的为(/root/.jupyter/jupyter_notebook_config.py)

vim /root/.jupyter/jupyter_notebook_config.py
#改以下内容
c.NotebookApp.allow_root =True
c.NotebookApp.ip='*'
c.NotebookApp.open_browser = False

修改密码

jupyter notebook password

重启脚本

通过该脚本进行重启

#!/bin/bash
this_pid=`lsof -i:8888|awk '{print $2}'|uniq|grep [0-9]`
kill -9 ${this_pid}
cd /home/soft/jupyter
rm -f nohup.out jupyter_server.log
nohup jupyter notebook > jupyter_server.log &
sleep 2

相关文章

网友评论

      本文标题:centos下jupyter notebook的安装

      本文链接:https://www.haomeiwen.com/subject/zrvqactx.html