CentOS 安装 Jupyter Notebook

安装依赖

yum -y groupinstall "Development Tools"
yum -y install python-devel

使用虚拟环境

pip install virtualenv
virtualenv pyenv
source pyenv/bin/activate

Jupyter 安装 & 配置

  • 安装
pip install jupyter
  • 目录准备

我们先为 Jupyter 相关文件准备一个目录:

mkdir /data/jupytercd /data/jupyter

再建立一个目录作为 Jupyter 运行的根目录:

mkdir /data/jupyter/root
  • 密码准备

执行以下命令:

Python2.x

python -c "import IPython;print IPython.lib.passwd()"

Python3.x

python -c "import IPython;print(IPython.lib.passwd())"
  • 生成配置
jupyter notebook --generate-config --allow-root
  • 修改配置
vi /root/.jupyter/jupyter_notebook_config.py

增加如下配置

c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.ip = "*"
c.NotebookApp.password = u'sha1:363dfc3e77be:e214195be210befc7cb0b6cf141f9ef7a2d970c8’
c.ContentsManager.root_dir = '/data/jupyter/root'

c.NotebookApp.password的内容换成刚才生成的内容。

启动 jupyter

jupyter notebook
  • 指定ip可以使用
jupyter notebook --ip='172.16.8.110'

如果遇见编码问题,可以使用

LANG=zn jupyter notebook --ip='172.16.8.110'
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值