centos7 安装jupyter

1、基本包安装

yum update -y
yum install python-pip -y
yum install bzip2 -y
yum groupinstall "Development Tools" -y

  由于服务器的生产环境的packages较多,版本也不一致,所以需要设置虚拟环境,具体操作参照 https://www.cnblogs.com/QiuPing-blog/p/16088424.html

  安装IPython、jupyter和Notebook

pip install ipython jupyter notebook

 

2、配置jupyter

   生成jupyter的配置文件

jupyter notebook --generate-config

#生成的config file在/root/.jupyter/jupyter_notebook_config.py

  生成加密密码

#当前版本python3
python -c "import IPython; print(IPython.lib.passwd())"

#输入两次密码后保存密文密码:
sha1:ddd78df8d7fqe7f8663jk3jk9

#生成jupyter 默认配置文件并修改:
jupyter notebook --generate-config --allow-root

#修改配置文件
vim /root/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip="*"
c.NotebookApp.allow_root=True
c.NotebookApp.open_browser=False
c.NotebookApp.port=8888
#密文密码粘贴如下
c.NotebookApp.password=u'sha1:ddd78df8d7fqe7f8663jk3jk9'
c.ContentsManager.root_dir='/data/jupyter/root'

  

3、运行jupyter

nohup jupyter notebook > /data/jupyter/jupyter.log 2>&1 &

  可根据需求配置为systemctl 服务,具体操作请参照 https://www.cnblogs.com/QiuPing-blog/p/16055625.html

 

posted @ 2022-04-01 16:40  QiuPing  阅读(382)  评论(0编辑  收藏  举报